Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Passing Arrays from Perl to Stored Procedures

by OM_Zen (Scribe)
on Mar 07, 2003 at 18:05 UTC ( #241212=note: print w/replies, xml ) Need Help??

in reply to Passing Arrays from Perl to Stored Procedures

Hi ,

The backend stored procedure , HOW can a stored procedure accept an array first .You are thinking of passing an array to stored procedure , but how iwll a stored procedure accept it The procedure written like

CREATE OR REPLACE PROCEDURE (?????(the array cannot be used ) IN) + as You can only use CREATE OR REPLACE PROCEDURE (v_scalr_in IN) as

Hence trying to pass an array to a stored procedure which can never accept an array is not how it could be working

That you could do is concatenate the scalar values into a single scalar value in perl and then send it to the Orcale stored procedure and then parse it with substr inside the oracle procedur and use it like

my $a; foreach (@arrayofvariables){ $a .= $_; } my $proc_run = "BEGIN run_proc(:1) END\;" # then bind it with $a

The stored procedure has to

CREATE OR REPLACE PROCEDURE ( v_scalar_in IN VARCHAR) AS here you have to substr with the index of "," and then send it i +n for loop for your processing

The idea of sending arrays to stored procedures is not that good in that stored procedures , I mean the databases do not have these array only the table and record type , mya be try using those

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://241212]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2018-01-19 09:54 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (217 votes). Check out past polls.