On Sep 9, Sharma, Amit scribed:
>
> Hi,
> While trying to execute the following SQL , I get the following error: Can't
> call method "execute" on an undefined value at x.pl line 105.
> ..
> my $sqlSch = "SELECT SEQ_NO from $TableName";
The substitution of $TableName (if its populated) has already occurred at
this point.  What's the value of $sqlSch?
I use this type of code all the time, and have never had a problem
(v1.12).

> my $sth = $dbHandle->prepare($sqlSch);
> $sth->execute();

Can you cut down the script to just these lines and reproduce the
problem?  Your error was reported at line 105.  The error you are
reporting seems to indicate that $sth is the undefined value at this
point.  The prepare would have already identified any SQL errors or
undefined values.  Are you shore the prepare() didn't fail?  That would
cause $sth to be undefined.

> $sth->bind_columns(undef, \$SequenceNum);
> ..
>
>
> However, when I hard-code the value for the table name, as shown below, the
> script works fine.
>
> my $sqlSch = "SELECT SEQ_NO from Employee_data";
> my $sth = $dbHandle->prepare($sqlSch);
> $sth->execute();
> $sth->bind_columns(undef, \$SequenceNum);
> ..
>
>
> Am unable to figure out the problem. While debugging, the print function
> shows correct value for the variable containing the correct table name for
> $TableName.
>
> While looking at the archives, I figured out that it could be a bug with
> DBD::Oracle 1.13 & 1.14 and I need to patch my system. However, am not too
> sure about that, and want to confirm with the list before applying a patch.
> Incase, a patch has to be applied, could someone tell me how to go about
> identifying the version of DBD on solaris 8 box and where can I get the
> patch.

I would just upgrade using CPAN and skip the patches.  To confirm current
versions:

use DBI;
use DBD::Oracle;
print "\$DBI::VERSION=$DBI::VERSION\n";
print "\$DBD::Oracle::VERSION=$DBD::Oracle::VERSION\n";

HTH,
Dave

Reply via email to