Initializing table types in Oracle -
i have such simple procedure , typetest table type.
create or replace procedure testprocedure (dayname out typetest )is begin dayname(1):='monday'; dayname(2):='1'; dayname(3):='good'; end testprocedure; create or replace type typetest table of varchar2(50);
it compiles normally, when run it, gives such exception:
"ora-06531:reference uninitialized collection".
can me please?
initialize dayname , extend (each time 1 or @ beginning 3):
create or replace procedure testprocedure (dayname out typetest )is begin dayname := typetest(); dayname.extend(3); dayname(1):='monday'; dayname(2):='1'; dayname(3):='good'; end testprocedure;
test:
declare t typetest; begin testprocedure(t); in 1..t.count() loop dbms_output.put_line(t(i)); end loop; end;
output:
monday 1
Comments
Post a Comment