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
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.