Subject Re: [firebird-support] IS NULL and query parameters
Author Nando Dessena
Helen,

>>in query parameters by doing:
>>
>> ? IS NULL
>>
>>It raises the exception:
>>
>>Dynamic SQL Error.
>>SQL error code = -804.
>>Data type unknown.
>>
>>when preparing the command.

H> Why would you try to do this? Null isn't a value.

he wants the expression to be true when the param is null. It is a
generally accepted (except for IB/Fb) method to have "optional"
parameters, especially in stored procedures.

H> What's wrong with

H> WHERE aValue = ? OR aValue IS NULL

H> ??

That's a different thing.
Firebird is rather limited in this regard. Other DBMSs are able
to get away without the data type in this case (since a data type
isn't really needed to compare with NULL).
I'm sure I read on some list an explanation why it has to be this way,
but I can't remember it.

Ciao
--
Nando Dessena
mailto:nandod@...
======================================================
I support Firebird, I am a Firebird Foundation member!
Join today at http://www.firebirdsql.org/ff/foundation
======================================================