Allows SQL expressions to be written for conditional values. nullif expressions can be used anywhere a value expression can be used; alternative for a case expression.


nullif(expression, expression)




  • nullif expression alternate for a case expression.

  • nullif expression simplifies standard SQL expressions by allowing you to express a search condition as a simple comparison instead of using a when...then construct.

  • You can use nullif expressions anywhere an expression can be used in SQL.

  • At least one result of the case expression must return a non-null value. For example the following results in an error message:

    select price, coalesce (NULL, NULL, NULL)
    from titles
    All result expressions in a CASE expression must not be NULL.
  • If your query produces a variety of datatypes, the datatype of a case expression result is determined by datatype hierarchy. If you specify two datatypes that the SAP ASE server cannot implicitly convert (for example, char and int), the query fails.

See also case, coalesce, select, if...else, where clause in Reference Manual: Commands.


ANSI SQL – Compliance level: Transact-SQL extension.


Any user can execute nullif.

Related concepts