Re: help with odd DBI perpare/execute errors

"Bruce Johnson" <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
> On Jun 3, 2015, at 7:19 AM, William Bulley <[email protected]> wrote:
> 
> According to Bruce  Johnson <[email protected]> on Wed, 06/03/15 at 10:10:
>> 
>> 
>> Make sure your original $query is delimited by double quotes, not single. 
> 
> I've tried _everything_!!
> 
> Single quotes.  Double quotes.  q{} and qq{} (using the latter now).
> 
> But no matter what I try DBI complains about the darn question mark!
> 
> It is infuriating, I tell you!   :-)

Well, I just tested MY theory (RHEL v6.5, oracle 11.2g,  oracle instant client for 11.2,  perl, v5.10.1 (*) built for x86_64-linux-thread-multi) with:

#!/usr/bin/perl
use strict;
use DBI;
my $dbh= DBI->connect(“dbi:Oracle:host=$host", $user, $pass, {RaiseError =>1});

my $qry1 ='select ? from dual';
my $qry2 = "select ? from dual";
my $sth = $dbh->prepare($qry1);
$sth->execute('foo');
my ($res)=$sth->fetchrow();
print "single quote result is $res \n";
$sth =$dbh->prepare($qry2);
$sth->execute('bar');
($res)=$sth->fetchrow();
print "double quote result is $res \n";
exit;

And got:
# ./qmarktest.pl 
single quote result is foo 
double quote result is bar 

So yet another fine theory destroyed by reality…

Possibly some sort of character set mess up? Could your 'question mark' be something else in the script? Maybe a 16-bit vs 8-bit character?  I’ve had some weird issues in the past when I was handed a 16-bit unicode text file of insert statements and tried to run them.  

-- 
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.