Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 » UltraLite - Database Management and Reference » UltraLite SQL Reference » UltraLite SQL functions » SQL functions (E-O)


NULLIF function [Miscellaneous]

Provides an abbreviated CASE expression by comparing expressions.

NULLIF( expression-1, expression-2 )
  • expression-1   An expression to be compared.

  • expression-2   An expression to be compared.


Data type of the first argument.


NULLIF compares the values of the two expressions.

If the first expression equals the second expression, NULLIF returns NULL.

If the first expression does not equal the second expression, or if the second expression is NULL, NULLIF returns the first expression.

The NULLIF function provides a short way to write some CASE expressions.

See also
Standards and compatibility
  • SQL/2003   Core feature.


The following statement returns the value a:

SELECT NULLIF( 'a', 'b' );

The following statement returns NULL.

SELECT NULLIF( 'a', 'a' );