Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could pass in an Oracle collection type as a parameter.</p> <p>The collection could be a key value pair such as an associative array indexed by a varchar. In that example, the index could be the SID and the value could be the SNAME.</p> <p>Read here to learn about collections: <a href="http://docs.oracle.com/cd/B10501_01/appdev.920/a96624/05_colls.htm" rel="nofollow">http://docs.oracle.com/cd/B10501_01/appdev.920/a96624/05_colls.htm</a></p> <p>And here for associative arrays in particular: <a href="http://www.oracle-base.com/articles/9i/AssociativeArrays9i.php" rel="nofollow">http://www.oracle-base.com/articles/9i/AssociativeArrays9i.php</a></p> <p>Alternatively you could pass two parameters, both collections holding varchar values (such as DBMS_SQL.VARCHAR2_TABLE types) the first holding the SID and the second holding the corresponding SNAME values they would effectively be linked by their index number. See here for DBMS_SQL defined types: <a href="http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_sql.htm" rel="nofollow">http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_sql.htm</a></p> <p>Hope it helps...</p> <p>EDIT:</p> <p>If you are declaring all types and performing all actions within a package then:</p> <pre><code>-- Declare type TYPE student_coltype IS TABLE OF student%ROWTYPE INDEX BY BINARY_INTEGER; -- Declare variable of type student_col student_coltype; </code></pre> <p>If you want global types then you'll have to explicitly declare the columns:</p> <pre><code>CREATE TYPE student_rec AS OBJECT (SID VARCHAR2(10), SNAME VARCHAR2(50)); CREATE TYPE student_collection AS TABLE OF student_rec; </code></pre> <p>You can then use the student collection type with your DB to pass collections of student data into and out of procedures and functions.</p> <p>The docs for using oracle objects are here: <a href="http://docs.oracle.com/cd/B19306_01/appdev.102/b14260/adobjint.htm" rel="nofollow">http://docs.oracle.com/cd/B19306_01/appdev.102/b14260/adobjint.htm</a></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