Oddity using placeholders w/ Oracle
From: Steven Lembark (lembark_at_wrkhors.com)
Date: 07/24/04
- Next message: Tim Bunce: "Re: How to perform JOINs with DBI"
- Previous message: Robert: "Re: DBI and DBD::Oracle install"
- Next in thread: Tim Bunce: "Re: Oddity using placeholders w/ Oracle"
- Reply: Tim Bunce: "Re: Oddity using placeholders w/ Oracle"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 23 Jul 2004 18:28:38 -0400 To: dbi-users <dbi-users@perl.org>
Maybe I've just missed a known bug, but this seems kinda odd...
The code below is running againsed Oracle-9.2.0.4 on RHE-3.0.
Called with the same variable interpolated and as a placeholder
it works or doesn't. I have any amount of code floating around
here that uses placeholders and DOES work...
Any suggesions?
$ perl example;
DBI Version: 1.43
DBD Version: 1.15
Value is: 'Q8R2H7'
Result A: '133387'
Result B: ''
$ cat example;
use DBI;
use DBD::Oracle;
use Data::Dumper;
print "\n\tDBI Version: $DBI::VERSION\n";
print "\n\tDBD Version: $DBD::Oracle::VERSION\n";
my @connect_args =
(
"dbi:Oracle:host=$ENV{ORACLE_HOST};sid=$ENV{ORACLE_SID}",
$ENV{ORACLE_USER},
$ENV{ORACLE_PASS},
{
RaiseError => 1
}
);
my $dbh = DBI->connect( @connect_args );
my $value = 'Q8R2H7';
print "\n\tValue is: '$value'\n";
my $a =
qq{
select entry_id
from entry
where entry_accno = '$value'
};
my $b =
q{
select entry_id
from entry
where entry_accno = ?
};
{
# this works...
my $handle_a = $dbh->prepare( $a );
$handle_a->execute;
my @row = $handle_a->fetchrow_array;
print "\n\tResult A: '@row'\n";
}
{
# this doesn't
my $handle_b = $dbh->prepare( $b );
$handle_b->execute( $value );
my @row = $handle_b->fetchrow_array;
print "\n\tResult B: '@row'\n";
}
-- Steven Lembark 9 Music Square South, Box 344 Workhorse Computing Nashville, TN 37203 lembark@wrkhors.com 1 888 359 3508
- Next message: Tim Bunce: "Re: How to perform JOINs with DBI"
- Previous message: Robert: "Re: DBI and DBD::Oracle install"
- Next in thread: Tim Bunce: "Re: Oddity using placeholders w/ Oracle"
- Reply: Tim Bunce: "Re: Oddity using placeholders w/ Oracle"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|