how to initialize a pl/sql array (merged by CM) [message #446122] |
Fri, 05 March 2010 09:06  |
astik.mondal
Messages: 14 Registered: March 2008 Location: Kolkata
|
Junior Member |
|
|
Hi All,
I have written a pl/sql function. But it is returing null value.
Because I have initialize pl/sql table.
can Anybody let me know how to initialize it?
--------------
return v_list
As
type value_list is table of varchar2(100);
v_list value_list:= value_list()
begin
FOR i IN types.FIRST .. types.LAST
LOOP
v_ist(i).id := v_type_id;
v_list(i).valueid := v_valueid;
v_list(i).valuename := v_value;
END LOOP;
return v_list;
end
Thanks,
Astik
|
|
|
|
Re: How to initialize a pl/sql table. [message #446133 is a reply to message #446122] |
Fri, 05 March 2010 09:29  |
flyboy
Messages: 1903 Registered: November 2006
|
Senior Member |
|
|
astik.mondal wrote on Fri, 05 March 2010 16:06can Anybody let me know how to initialize it?
What about consulting PL/SQL User's Guide and Reference, available with other Oracle documentation e.g. online on http://tahiti.oracle.com/?
Most probably it returns empty list (not NULL). Maybe you are lucky and TYPES is empty list, otherwise it would fail with "ORA-06533: Subscript beyond count" (as you only initialized it as empty collection and did not extend for updated elements). Anyway, as TYPES along with P_IST are never declared, it is hard to tell what you are really running and how you treat the result.
|
|
|