Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perl Monks

I'm trying to find a way to send an array to a stored sql procedure which interprets it as an cursor, i.e., example:

my @player_list = ('john','peter','mary','joseph'); #Prodedure $sth = $dbh->prepare(q(BEGIN :ret := Proc.getPlayerIds(:in_player_list +,:out_list_ids);END;) $sth->bind_param_inout(':ret',\$ret, 1024); $sth->bind_param(':in_player_list', \@player_list, 0, {ora_type => ORA +_RSET}) or croak sth->errstr; $sth->bind_param_inout('::out_list_ids', \$ids, 0, {ora_type => ORA_RS +ET}) or croak sth->errstr;

However, if i do this, i get the following error:

Uncaught exception form user code: DBI bind_param: invalid number of arguments: got handle +4, expected + between 1 and 2

My question is, how do I convert my array to a cursor, or how do i send it directly to the procedure?

Can anyone help me? Thanks

Replies are listed 'Best First'.
Re: Send array to SQL procedure as a cursor (temp table)
by tye (Sage) on Jul 22, 2015 at 14:18 UTC

    You create a temporary table and insert the items from your list into that and then create a cursor for a query against that temp table.

    - tye        

      Thank you for the information, i will try this alternative.

Re: Send array to SQL procedure as a cursor
by Pope-O-Matik (Pilgrim) on Jul 22, 2015 at 20:49 UTC