"I want is to fill it during the PL/SQL
code itself, with INSERT statements"
It's like populating any other PL/SQL variable: we have to use INTO. Only because we're populating multiple rows we need to use the BULK COLLECT syntax.
declare
l_array your_nested_table_type;
begin
select col1
bulk collect into l_array
from t72;
end;
/
If the result set returns a lot of records it is a good idea to use the LIMIT clause inside a loop. This is because PL/SQL collections - just like every other PL/SQL variable - are held in session memory. So we don't want the array to get too big, otherwise it might blow the PGA. Find out more.
edit
"I edited the question to clarify
specifically what I want"
sigh Tokenizing a string is an altogether different issue. I have previously posted solutions in two SO threads. If you're using 9i or earlier use this approach. Otherwise use this regex solution (actually this splits the string into numeric tokens, but it is easy enough to convert to characters).
edit 2
"I only want to be able to use the
type "internally" (within the Stored
Procedure) by adding values to it. Is
this something I can do with the first
link?"
Sure. Why not?
SQL> declare
2 local_array tok_tbl;
3 begin
4 local_array := parser.my_parse('Keith Pellig,Peter Wakeman,Ted Bentley,Eleanor Stevens');
5 local_array.extend();
6 local_array(5) := 'Reese Verrick';
7 for i in local_array.first()..local_array.last()
8 loop
9 dbms_output.put_line(local_array(i));
10 end loop;
11 end;
12 /
Keith Pellig
Peter Wakeman
Ted Bentley
Eleanor Stevens
Reese Verrick
PL/SQL procedure successfully completed.
SQL>
Here I have re-used my SQL type, but it would work just as well if TOK_TBL
were declared in the PL/SQL package instead.