I'm not sure what you want to pass an array for... but note that Oracle can use "tables" of literals in SQL. That might be a way to do what you want.

Here's the code in SQL that you can most likely also use in DBI:

create type StringTable as table of varchar2(4000); select A.dummy, B.column_value from dual A, table(StringTable('one', 'two', 'three')) B;
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:
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:

begin myproc(?, StringArray(?,?,?)); end;
and pass a flat list of 4 values.

In reply to Re: Passing arrays to an oracle stored procedure by bart
in thread Passing arrays to an oracle stored procedure by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.