in reply to (jeffa) Re: How I can get the returned cursor from database in PERL program?
in thread How I can get the returned cursor from database in PERL program?
# ORACLE STORED PROCEDURE # CREATE OR REPLACE PACKAGE selectall AS TYPE my_cursor IS REF CURSOR; PROCEDURE CATEGORYLIST1(CAT_CURSOR OUT my_cursor); END selectall; / CREATE OR REPLACE PACKAGE BODY selectall AS PROCEDURE CATEGORYLIST1(CAT_CURSOR OUT my_cursor) IS BEGIN OPEN CAT_CURSOR FOR SELECT KP_CH_CATEGORY_NAME FROM KP_CH_CATEGORY ORDER BY KP_CH_CATEGORY_NAME; CLOSE CAT_CURSOR; END CATEGORYLIST1; END selectall; / # Perl code # #!/usr/bin/perl -w BEGIN { $|=1; open(STDERR,">&STDOUT"); print("content-type:text/html\n\n"); } use CGI qw/:all/; use DBI; use DBD::Oracle qw(:ora_types); $ENV{ORACLE_HOME}="/u01/app/oracle/product/8.1.7"; my $dbh = DBI -> connect('dbi:Oracle:host="192.168.7.80";sid="ktpn";po +rt=1521"', 'cwl', 'cwl', { RaiseError => 1, AutoCommit => 1 } ) || die "Error while connecting to database : $! \n"; my $sth = $dbh->prepare(q{BEGIN:selectall.CATEGORYLIST1(:p_my_cursor); + END;}); my $my_cursor; print "Executed upto this point"."\n"; $sth->bind_param_inout(":p_my_cursor", \$my_cursor, 0, { ora_type => O +RA_RSET }); $sth->execute; $sth->finish; my @row; while( @row = $my_cursor->fetchrow_array) { foreach $_ (@row) { print $_; print "\n"; } } $my_cursor->finish; $dbh->disconnect; # ERROR # Executed upto this point DBD::Oracle::st execute failed: ORA-01008: not all variables bound (DB +D ERROR: OCIStmtExecute) at /var/www/html/narayan/cgi-bin/Try.cgi lin +e 19. DBD::Oracle::st execute failed: ORA-01008: not all variables bound (DB +D ERROR: OCIStmtExecute) at /var/www/html/narayan/cgi-bin/Try.cgi lin +e 19.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: How I can get the returned cursor from database in PERL program?
by rdfield (Priest) on Mar 11, 2002 at 10:08 UTC | |
by Anonymous Monk on Mar 11, 2002 at 10:45 UTC | |
by rdfield (Priest) on Mar 11, 2002 at 11:03 UTC | |
by Anonymous Monk on Mar 11, 2002 at 11:33 UTC | |
by rdfield (Priest) on Mar 11, 2002 at 11:38 UTC | |
by Anonymous Monk on Mar 12, 2002 at 05:16 UTC |