NULLIF: Returning a Null Value When Parameters Are Equal

How to:

NULLIF returns a null (missing) value when its parameters are equal. If they are not equal, it returns the first value. The field to which the value is returned should have MISSING ON.

Syntax: How to Return a Null Value for Equal Parameters

NULLIF(arg1,arg2)

where:

arg1,arg2

Any type of field, constant, or expression.

Are the input parameters that are tested for equality. They must either both be numeric or both be alphanumeric.

The output data type is the same as the input data types.

Example: Testing for Equal Parameters

NULLIF tests the DAMAGED and RETURNS field values for equality.

NULLIF(DAMAGED, RETURNS)

For DAMAGED=3 and RETURNS = 3, the result is MISSING (.).

For DAMAGED=2 and RETURNS = 3, the result is 2.

WebFOCUS

Feedback