At this point it would really hep investing in a good perl book. Learning
Perl by O'Reilly is a good one to start with.
Ilya
-----Original Message-----
From: [EMAIL PROTECTED]
To: Ronald J Kimball
Cc: [EMAIL PROTECTED]
Sent: 5/21/02 7:40 AM
Subject: Re: DBI "Prepare" Statement Not Working
Thank you! That worked and it returned the result set of my sql query.
Can I bother you with another question - how do I open up a file and
redirect the result set into it?
Deb Vredeveld
Ronald J Kimball
<rjk-dbi@focalex. To:
[EMAIL PROTECTED]
com> cc:
[EMAIL PROTECTED]
Subject: Re: DBI
"Prepare" Statement Not Working
05/21/02 09:32 AM
On Tue, May 21, 2002 at 09:22:23AM -0400, [EMAIL PROTECTED]
wrote:
> Okay thanks, I added "my $dbh;" prior to the subroutine and am still
> receiving the same error. Here is the code:
Adding a my $dbh outside the subroutine doesn't change the fact that you
still have $dbh lexically scoped inside the subroutine:
> 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";
> }
You could simply change this to:
$dbh = DBI->connect( ... ) or die "...";
to assign to the $dbh which you declare at the top of the file, but it
would probably be better for the subroutine to return the database
handle.
use strict;
use DBI;
my $dbh = db_connect();
sub db_connect {
my $db_connect = 'DUMY';
my $dbh = DBI->connect("dbi:Oracle:$db_connect","FMC","FMC")
or die "Database connection not made: $DBI::errstr";
}
Ronald