Subject Re: [firebird-support] Prepared Statement with "? IS NULL" Generates error
Author Helen Borrie
At 01:22 AM 23/02/2005 +0000, you wrote:


>Hi,
>
>I'm trying to create the Prepared Statement below with "? IS NULL" in
>it. This generates an error in Firebird 1.5.2 SS.
>
>Is there a workaround for this, or is this going to be fixed anytime
>soon? MySQL, Postgres, Oracle, etc., etc. support this syntax, so it
>creates a signifucant incompatibility if you are trying to migrate to
>Firebird.
>
>The statement is:
>
>UPDATE SIMPLENAME SET PKEY = ?, FNAME = ? WHERE ((? IS NULL AND PKEY
>IS NULL) OR PKEY = ?) AND ((? IS NULL AND FNAME IS NULL) OR FNAME = ?)

It aint gonna get fixed because it aint broke.

It's not valid to parameterise column names. The parameterised statement
should be

UPDATE SIMPLENAME
SET PKEY = ?,
FNAME = ?
WHERE
((aField IS NULL AND PKEY IS NULL) OR PKEY = ?)
AND
((aField IS NULL AND FNAME IS NULL) OR FNAME = ?)

./heLen