I have a stored procedure which returns a PL/SQL table of records.
I need to understand how I can access this table return using Perl DBI/DBD and Oracle 8.1.7.
I use the following statement to pass in a string and 2 dates.
sub prepare_statement{
my $sp = $dbh->prepare(q{
BEGIN
sla_csv.create_csv(
:CUSTOMER,
:START_DATE,
:END_DATE,
:TBL_OUT);
END;
});
$IN1="ALL";
$IN2="01/09/2002";
$IN3="11/11/2002";
$Out1=$tbl_files_out;
$sp->trace(5);
$sp->bind_param(":CUSTOMER
", $IN1);
$sp->bind_param(":START_DA
TE", $IN2);
$sp->bind_param(":END_DATE
", $IN3);
$sp->bind_param_inout(":TB
L_OUT", \$Out1,'5000',{ ora_type => ORA_RSET });
$sp->execute;
}
The script errors with the following:-
DBI::st=HASH(0x42291c) trace level set to 1 in DBI 1.30-nothread
<- bind_param(':CUSTOMER' 'ALL')= 1 at test.pl line 73
<- bind_param(':START_DATE' '01/09/2002')= 1 at test.pl line 74
<- bind_param(':END_DATE' '11/11/2002')= 1 at test.pl line 75
<- bind_param_inout(':TBL_OUT
' SCALAR(0x505610) ...)= 1 at test.pl line 76
<- FETCH('ImplementorClass')=
'DBD::Oracle::db' ('ImplementorClass' from cache) at DBI.pm line 990
!! ERROR: 6550 'ORA-06550: line 3, column 1:
PLS-00306: wrong number or types of arguments in call to 'CREATE_CSV'
ORA-06550: line 3, column 1:
PL/SQL: Statement ignored (DBD ERROR: OCIStmtExecute)'
<- execute= undef at test.pl line 77
DBD::Oracle::st execute failed: ORA-06550: line 3, column 1:
PLS-00306: wrong number or types of arguments in call to 'CREATE_CSV'
ORA-06550: line 3, column 1:
PL/SQL: Statement ignored (DBD ERROR: OCIStmtExecute) at ./test.pl line 77.
<- DESTROY= undef at test.pl line 24
$
I imagine there is a neat way to reference the OUT parameter from a Stored Procedure when it is a PL/SQL table. I just dont know what it is.
Start Free Trial