Subject Re: [ib-support] (:APARAM IS NULL) in SELECT WHERE clause...
Author Claudio Valderrama C.
""tibotaka"" <belan@...> wrote in message
news:a94jrd+jl9k@......
>
> MY QUESTION: Why SELECT statement
>
> SELECT SUM(PRICE) FROM MY_DATA
> WHERE ((:ACREW_ID IS NULL) OR (CREW_ID = :ACREW_ID)) AND
> ((:ASALESREP_CODE IS NULL) OR (SALESREP_CODE = :ASALESREP_CODE))
>
> don't work alone? I always get compile error

In the procedure, you are forced to declare the variables' data type. Hence,
it's known beforehand. However, in a direct SQL statement including
:param is null
or
cast(:param as some_data_type)
the engine clearly lacks a crystal ball to guess what data type you want for
"param". Hence, it complains.

C.
--
Claudio Valderrama C. - http://www.cvalde.com - http://www.firebirdSql.org
Independent developer
Owner of the Interbase® WebRing