Reputation: 139
My code is:
create or replace type DateTab is table of date;
declare
type Famous_Dates is table of DateTab;
v_data DateTab;
v_nested Famous_Dates:=Famous_Dates();
begin
for i in 1..5 loop
v_data(i):=sysdate;
end loop;
v_data.delete(2);
insert into v_nested
values v_data;
end;
/
I get this error saying my v_nested variable is not initialized with a constructor, but it is.
I know there was a question like this on StackOverflow, but it didn't help me, as I have something else in my code.
Upvotes: 0
Views: 130
Reputation: 142720
You are missing two things, as marked in code below:
SQL> declare
2 type Famous_Dates is table of DateTab;
3 v_data DateTab := datetab(); --> this
4 v_nested Famous_Dates:=Famous_Dates();
5 begin
6 for i in 1..5 loop
7 v_data.extend; --> this
8 v_data(i):=sysdate;
9 end loop;
10 v_data.delete(2);
11
12 select v_data bulk collect into v_nested from dual;
13 end;
14 /
PL/SQL procedure successfully completed.
SQL>
Upvotes: 2