The NEGATOR modifier

The NEGATOR modifier is available for Boolean functions. Two Boolean functions are negator functions if they take the same arguments, in the same order, and return complementary Boolean values.

For example, the functions equal(a,b), which returns TRUE if a is equal to b, and notequal(a,b), which returns FALSE if a is equal to b, are negator functions. The optimizer might choose to execute the negator function you specify if it is less expensive than the original function.

Tthe following figure shows how to use the WITH clause of a CREATE FUNCTION statement to specify a negator function.
Figure 1: Specify a negator function.
CREATE FUNCTION equal( a dtype1, b dtype2 )
   RETURNING BOOLEAN
   WITH ( NEGATOR = notequal );
. . .
END FUNCTION;
Tip: By default, any SPL routine can handle NULL values that are passed to it in the argument list. In other words, the HANDLESNULLS modifier is set to YES for SPL routines, and you cannot change its value.

For more information on the COMMUTATOR and NEGATOR modifiers, see the Routine Modifier segment in the HCL OneDB™ Guide to SQL: Syntax.