Okay thanks, I added "my $dbh;" prior to the subroutine and am still receiving the same error. Here is the code:
#!/usr/local/bin/perl # $ENV{'ORACLE_HOME'} = '/apps/oracle/product/8.1.7'; $ENV{'NLS_LANG'} = 'AMERICAN_AMERICA.WE8ISO8859P1'; $ENV{'NLS_DATE_FORMAT'} = 'DD-MON-RR'; #$gdb_connect = substr($net_connect,1); my $dbh; my $sth; my @fields; my @row; my $cursor_x; my ($rollup_code, $rollup_value, $french_flag); db_connect (); db_statement (); $dbh->disconnect; #--------------------------------------------------------------------------------- sub db_connect { use DBI; use strict; my $db_connect = 'DUMY'; my $dbh = DBI->connect("dbi:Oracle:$db_connect","FMC","FMC") or die "Database connection not made: $DBI::errstr"; } #--------------------------------------------------------------------------------- sub db_statement { my $sth = $dbh->prepare("select rollup_code, rollup_value, french_flag from FMC_REPORT_CREATE_PARAMS where aggr_rpt_id = 2 order by report_seq_num"); $sth->execute; #my $rv = $sth->bind_columns(\$rollup_code, \$rollup_value, \$french_flag); while ( @row = $sth->fetchrow_array ) { print "@row\n"; } } #----------------------------------------------------------------------------------- Deb Vredeveld "Felix Geerinckx" <felix_geerinckx@h To: [EMAIL PROTECTED], [EMAIL PROTECTED] otmail.com> cc: Subject: Re: DBI "Prepare" Statement Not Working 05/21/02 09:06 AM [Private message returned back to list] Please send further questions to the mailing list instead of by private email. Other list members may want to contribute. > > >The query does work in Sql*plus. I'm not getting any errors from my >connect string. Here is the sub with my dbh definition: > >sub db_connect >{ >use DBI; >use strict; > >my $db_connect = 'DUMY'; >my $dbh = DBI->connect("dbi:Oracle:$db_connect","FMC","FMC") > or die "Database connection not made: $DBI::errstr"; >} Your $dbh is local to your db_connect subroutine. It's value is not defined outside of 'db_connect'. If you use strict; these kind of errors will be catched. Either put my $dbh; outside of any subroutine, or start passing it around as parameter/return value. -- felix _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]