Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

invoke oracle stored procedure from perl

by perlCrazy (Monk)
on Mar 07, 2007 at 17:50 UTC ( [id://603651]=perlquestion: print w/replies, xml ) Need Help??

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

Hi, I am trying to call Store Procedure (SP) from perl. Getting error.
When I run the SP from sqlplus command: it returns data successfully, like this:
here is the description of procedure:
SQL> describe sp_du
PROCEDURE sp_du
Argument Name Type in/Out Default?
------------ ----------------------- ------ --------
PARA_TB VARCHAR2 IN DEFAULT
PARA_TYPE VARCHAR2 IN DEFAULT
PARA_TEMP_TABLE VARCHAR2 IN DEFAULT
SQL> begin
2 sp_du;
3 end;
4 /
TABLESPACE DATAFILE NAME TOTAL USED USED %
------------ --------------------------------------------- ----- ----- -----
| DBATOOLS /oradata/002/ORAEVLD1/USERTSP/dbatools01.dbf 50 0 2%
| SPOTFIRE_L /oradata/002/ORAEVLD1/USERTSP/SPOTFIRE_LIB_DA 100 1 2%
| SPOTFIRE_L /oradata/002/ORAEVLD1/USERTSP/SPOTFIRE_LIB_IN 50 0 0%
PL/SQL procedure successfully completed.
here is my perl code that I am using to execute
eval { my $func = $dbh->prepare(q{ BEGIN :curs := sp_du; END; }); # must specify the ora_type of ORA_RSET # so code knows it is a cursor $func->bind_param_inout(":curs ", \$result, 0, { ora_type => ORA_RSET}); $func->execute; $func->finish; }; if( $@ ) { warn "Execution of stored procedure failed use:\n\t$DBI::errstr\n$@ +"; } while(my $hashRef = $result->fetchrow_hashref) { foreach(keys %$hashRef) { print "$_ is $hashRef->{$_}\n"; } } $result->finish;
above code throws an error :
Execution of stored procedure failed because: Can't bind unknown placeholder ':curs ' (':curs ') Pls. advice.
Thanks in advance

Replies are listed 'Best First'.
Re: invoke oracle stored procedure from perl
by Anonymous Monk on Mar 08, 2007 at 07:39 UTC
    Try without the space ':curs'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://603651]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-23 15:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found