Page 1 of 1

comparing with null values

Posted: Wed Apr 08, 2009 3:42 am
by dnat
Hi,

When we compare two fields

If (link1.A=Link1.B) then 1 Else 0

Now when Link1.B is a null value what would be the result?

Posted: Wed Apr 08, 2009 4:18 am
by miwinter
The row is a reject

Posted: Wed Apr 08, 2009 4:50 am
by dnat
what would be the value..1 or 0?

Posted: Wed Apr 08, 2009 5:34 am
by basu.ds
reject means '0'

Posted: Wed Apr 08, 2009 7:22 am
by ray.wurlod
If link.B is null then (link.A = link.B) is null.
The rule in server jobs (in DataStage BASIC) is that, if the test expression is null, then the Else path is taken, on the grounds that one can not assert that null is "true". The Else path is taken if the expression is not true (which is not necessarily the same thing as "false").
Welcome to the world of no data types, where rules of this kind are necessary.

Posted: Wed Apr 08, 2009 7:55 am
by chulett
And welcome to E.F. Codd's world of three-valued logic: True, False and Who the Heck Knows. :wink: