in reply to Passing arrays to an oracle stored procedure
Here's the code in SQL that you can most likely also use in DBI:
This example makes a chartesian join of data from system table dual (with 1 row of one column dummy having the value 'X') with my emulated table of literals, producing 1*3 = 3 rows:create type StringTable as table of varchar2(4000); select A.dummy, B.column_value from dual A, table(StringTable('one', 'two', 'three')) B;
DUMMY COLUMN_VALUE ----- ------------------ X one X two X three
Likewise, if your stored procedure accepts a parameter of type StringArray, then you can just pass the data along this way:
StringTable('one', 'two', 'three')
Note that this will only work with table types where you don't specify index by, because the StringTable() here works as a constructor and that only works works with tables without index by.
The way to pass the data through the statement with placeholders, is by using as many placeholders as there are values:
and pass a flat list of 4 values.begin myproc(?, StringArray(?,?,?)); end;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Passing arrays to an oracle stored procedure
by vsdeepthi (Initiate) on Aug 11, 2007 at 15:30 UTC | |
by Anonymous Monk on Aug 23, 2013 at 09:13 UTC |