Re: Null variables
Posted in 1998
On Wed, 12 Aug 1998 18:44:22 +0200, "Florin Micle"
<florinmicle@gsc-mbh.de> wrote:
>Hi all,
>
> Does anyone know how can I see if a passed variable into a stored
>procedure in Informix (dbaccess) has null value? I can't compare it with
>null because I get a syntax error (null - undeclared variable) if I pass
>null value into another variable the evaluation of null = null returns
>false! I wish it returned true...
That would be a disaster.
> Can anyone give me a solution for this?
Look in Informix Guide to SQL: Syntax of February 1998, page 3-29.
This manual is available from http://www.informix.com/answers under
the Informix Dynamic Server 7.3 link. If you have an earlier version
of the engine you will find similar information in the appropriate SQL
Syntax manual under the SPL section under the IF statement.
What you do is:
if p_variable is null then
do something;
end if;
In sql you always have to use "is null" or "is not null" to test for
null values. The same has carried over to Informix SPL.
(I use prefix p_ for parameter variables and l_ for local variables to
never have to think about wheter my variable names would collide with
some reserved word or a column name. It also makes the code more
readable.)
>Thanks,
You'r welcome
>Florin.
Nils Myklebust
NM Data AS
Norway
E-mail: Nils.Myklebust@nmdata.com
FAQ at: http://www.iiug.org/techinfo/faq/faq_top.html
(Now with ODBC info under "Third party products".)