----- Original Message -----
From: "Ronald J Kimball" <[EMAIL PROTECTED]>
To: "M.W. Koskamp" <[EMAIL PROTECTED]>
Cc: "Ronnie Anderson" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Friday, January 11, 2002 11:50 PM
Subject: Re: dbi and nulls
> On Fri, Jan 11, 2002 at 10:05:56PM +0100, M.W. Koskamp wrote:
> >
> > ----- Original Message -----
> > From: "Ronnie Anderson" <[EMAIL PROTECTED]>
> > To: <[EMAIL PROTECTED]>
> > Sent: Friday, January 11, 2002 8:36 PM
> > Subject: dbi and nulls
> >
> >
> > <snip>
> > > my $hosthandler = $dbh->prepare(q{
> > > SELECT id
> > > FROM host
> > > WHERE tid = ?
> > > AND (domain = ? OR (? IS NULL AND domain IS NULL))
> > What are you binding to the second ? here?
> > There should be a column name there i think.
> > What are you tring to test.
> > Let's assume $DOMAIN contains 'foo'
> > Using binding below the statement will be:
> > domain = 'foo' OR ( 'foo' IS NULL AND domain IS NULL)
> > I dont think you have a column foo.
>
> 'foo' is not a column, 'foo' is a value.
>
> The SQL will be either:
>
> domain = 'foo' OR ( 'foo' IS NULL AND domain IS NULL )
>
Dunno what database you are passing it to.
But oracle will say you dont have a column foo.
If you are really checking the value then your statement is redundant.