Variable Bound

tomg_at_q8.nrnet.org
Date: 01/24/04


Date: Fri, 23 Jan 2004 19:03:15 -0500 (EST)
To: DBI Users <dbi-users@perl.org>

Hi,

I noticed a problem with Oracle8i on Linux 2.4.22 today and am
wondering if my grasp of variable binding (or lack thereof) is
the problem ---

I have a table with an char(8) datatype - a login name
I look up user passwords like so:

$query = qq |SELECT password FROM x WHERE y = ?|;
..
$sth->execute($z)

Now $z may be less than 8 chars in some instances, however,
variable binding with Postgres and MySQL succeeds.
In effect:
    SELECT password FROM x WHERE y = ?
is the same as saying
    SELECT password FROM x WHERE y = 'phil'
which works beautifully.

However...

In Oracle SELECT password FROM x WHERE y = 'phil' works fine
But SELECT password FROM x WHERE y = ? fails..

One has to use a SQL placeholder:
SELECT password FROM x WHERE y LIKE ?
$sth->execute('phil%');

Anyone have any ideas how to force Oracle to play nice here?
Problem reproducible, scripts available.
DBI 1.40 and DBD-Oracle 1.14 on Oracle 8.1.6.1.0 on Linux 2.4.22
Perl 5.8.0

Thanks!

-----------------------------------------------------------------------
Thomas Good e-mail: tomg@sqlclinic.net
Programmer/Analyst phone: (+1) 718.818.5528
Residential Services fax: (+1) 718.818.5056
Behavioral Health Services, SVCMC-NY mobile: (+1) 347.524.5631

// Welches ist das groessere Verbrechen?
// Massenvernichtungswaffen besitzen oder sie erfinden?



Relevant Pages