I'm having trouble trying to bind a PL/SQL cursor using DBI. I was
wondering if this is something you've seen before. Here are the details of
the environment I'm running on:
Perl version: 5.6.0
O/S SunOS 5.8
And here is the section of code I'm having a problem with:
32 use DBI;
33 use DBD::Oracle qw(:ora_types);
158 my $dbh;
159 $dbh = DBI->connect("dbi:Oracle:$oracle_sid",
160 $username,
161 $password,
162 { RaiseError => 0,
163 PrintError => 0,
164 AutoCommit => 1
165 } )
166 or die "Couldn't connect to Oracle DB; Error: " .
DBI->errstr;
1025 my $sql;
1026 $sql = "DECLARE my_rowid ROWID\;
1027 BEGIN
1028 OPEN :host_cursor FOR
1029 SELECT hostname, rowid
1030 FROM host WHERE clientname = :clientname\;
1031 END\;";
1037 $sth1 = $dbh->prepare($sql)
1038 or die "Couldn't prepare $sql; ERROR: " . DBI->errstr;
1039 $sth1->bind_param(":clientname", "$client");
1040 $sth1->bind_param_inout(":host_cursor",
1041 \$sth2, 0, { ora_type => ORA_RSET } )
1042 or die "Couldn't bind $sql; ERROR: " . DBI->errstr;
1043 $sth1->execute()
1044 or die "Couldn't execute $sql; ERROR: " . DBI->errstr;
1045 @row = $sth2->fetchrow_array;
1046 foreach $row ( @row ) {
1047 print STDOUT "host row = $row\n";
1048 }
When I get to line 1040 (the bind_param_inout method), the following error
is generated:
Argument "ORA_RSET" isn't numeric in subroutine entry at ftp_dbload.pl
line 1040, <LOAD> line 1734.
Can't bind :host_cursor, ora_type 0 not supported by DBD::Oracle at
ftp_dbload.pl line 1040, <LOAD> line 1734.
Any suggestions are appreciated.
Thanks,
Dick Taplin