Tarun
Tarun

Reputation: 537

Why bulk collect into clause is limiting the size of nested table in pl/sql

declare
   type yy is table of t12.name%type;
   y yy:=yy();
   n number:=1;
begin
   y.extend(10);
   select name bulk collect into y from t12;
   --select name into y(5) from t12 where id=1; If i uncomment this line it gives error
   for i in (select name from t12)
   loop
      dbms_output.put_line(y(n));
      n:=n+1;
   end loop;
end;

Upvotes: 0

Views: 954

Answers (1)

Ludovic Kuty
Ludovic Kuty

Reputation: 4954

Could you test without initializing y first ? Nested tables are not supposed to be initialized with bulk collect. Then you can add elements with extend.

declare
  type yy is table of t12.name%type;
  y yy;
begin
  select name bulk collect into y from t12;
end;

Upvotes: 1

Related Questions