RE: Binding undefs in DBD::Oracle

RE: Binding undefs in DBD::Oracle

am 06.03.2006 17:56:56 von Philip.Garrett

[Dbi-dev is for driver maintainers, not for general support questions.
I reposted to dbi-users.]

> -----Original Message-----
> From: Paul G. Weiss [mailto:paul@weiss.name]=20
> Sent: Monday, March 06, 2006 11:47 AM
> To: dbi-dev@perl.org
> Subject: Binding undefs in DBD::Oracle
>=20
> I always that the binding undef's in DBD::Oracle was the way to bind a
null, yet:
>=20
>=20
> DB<5> x $dbh->selectall_arrayref('select x,b from tbl where a=3D?',
undef,
> 4)
> 0 ARRAY(0x9b53010)
> 0 ARRAY(0x9ba6284)
> 0 'bbc0dfec7ba578f2dafc8f2eb42fbd3ae17cf300'
> 1 undef
>=20
> but
>=20
> DB<3> x $dbh->selectall_arrayref('select x,b from tbl where a=3D? =
and
b=3D?', undef, 4, undef) 0 ARRAY(0x9ba0530)
> empty array
>=20
> i.e. the 'b=3D?' in the statement where I bind the value to undef does
_not_ act like 'b is null'.
>=20
> Didn't this used to work? I've tried this with DBD::Oracle v1.16 and
1.17.
>=20
> -P

No, that won't work. There is a section dedicated to this in the DBI
manual,
under the heading "NULL Values".

=20
http://search.cpan.org/~timb/DBI-1.50/DBI.pm#Placeholders_an d_Bind_Value
s

I usually use "(b =3D ? or (b is null and ? is null))".

Philip