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'