Re: SQL IF

From: Jack Ostroff <jack_h_ostroff_at_groton.pfizer.com>
Date: 2000/06/13
Message-ID: <394651B4.681C4226_at_groton.pfizer.com>#1/1


Greg wrote:
>
> If I have the SQL code
>
> if (variable1 <> variable2) then....
>
> Works if the Variables have a value
> but if one of them is null, it doesn't.
>
> how to include the case one of the variables are null in the statement.

(hopefully this newsreader will let me post...)

[Quoted] Other readers have pointed out that NULL fails both = and <> tests. You might try DECODE(variable1, variable2, "they match", "they are different");
I believe that this does the right thing with NULL values.

Good luck. Received on Tue Jun 13 2000 - 00:00:00 CEST

Original text of this message