Skip to Main Content
  • Questions
  • How to set all elements of collections

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Arya.

Asked: July 17, 2016 - 5:02 pm UTC

Last updated: July 18, 2016 - 12:46 am UTC

Version: 9i

Viewed 1000+ times

You Asked

I've three questions

1) Suppose I have a collection of numbers say 300 values & i want to initialise with number 72
what would be the best way to do so ,rather than writing 300 times

2) I've to generate reports in pdf so what would you suggest any open source library for generating pdf or to use oracle reports

3) which utility should we use for logging and profiling



and Connor said...

1) example for nested table and associative array below

SQL> declare
  2    type t1 is table of int index by pls_integer;
  3    type t2 is table of int;
  4
  5    v1 t1;
  6    v2 t2;
  7  begin
  8    for i in 1 .. 300 loop
  9      v1(i) := 72;
 10    end loop;
 11
 12    v2 := t2();
 13    v2.extend(300);
 14    for i in 1 .. 300 loop
 15      v2(i) := 72;
 16    end loop;
 17  end;
 18  /

PL/SQL procedure successfully completed.


2)

You could use Application Express to do it, or BI Publisher. Others (that I have not used are below)

https://github.com/Pilooz/pl_fpdf

https://technology.amis.nl/2012/04/11/generating-a-pdf-document-with-some-plsql-as_pdf_mini-as_pdf3/

http://www.plpdf.com/plpdf.php


3) Check out Logger

https://github.com/OraOpenSource/Logger

Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library