Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>"I want is to fill it during the PL/SQL code itself, with INSERT statements"</p> </blockquote> <p>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.</p> <pre><code>declare l_array your_nested_table_type; begin select col1 bulk collect into l_array from t72; end; / </code></pre> <p>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. <a href="http://www.oracle.com/technology/oramag/oracle/08-mar/o28plsql.html" rel="nofollow noreferrer" title="Steven Feuerstein on &#39;On BULK COLLECT&#39; ">Find out more</a>. </p> <p><strong>edit</strong></p> <blockquote> <p>"I edited the question to clarify specifically what I want"</p> </blockquote> <p><em>sigh</em> 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 <a href="https://stackoverflow.com/questions/2866851/array-or-list-into-oracle-using-cfprocparam/2867785#2867785">this approach</a>. Otherwise use <a href="https://stackoverflow.com/questions/2635930/sql-query-to-translate-a-list-of-numbers-matched-against-several-ranges-to-a-lis/2636842#2636842">this regex solution</a> (actually this splits the string into numeric tokens, but it is easy enough to convert to characters).</p> <p><strong>edit 2</strong></p> <blockquote> <p>"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?"</p> </blockquote> <p>Sure. Why not?</p> <pre><code>SQL&gt; 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&gt; </code></pre> <p>Here I have re-used my SQL type, but it would work just as well if <code>TOK_TBL</code> were declared in the PL/SQL package instead.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload