Performing Null check using HANA SQL Script

You can go for using either NULLIF or COALESCE function to serve your requirement.

NULLIF (expression, expression"): This function will return the same type whatever is specified as the first expression.

Basically, NULLIF returns

  • The first expression if the two expressions are not equal.

  • NULL of type of first expressions if the expressions are equal

The other function available is COALESCE which basically checks if the first Value provided is NULL then it will return the second value.


c = COALESCE(b , a)

If b is null then the function will return an otherwise b. So If you need to put a null check and use some default value in place of NULL then you can go ahead and use COALESCE.

Updated on: 18-Dec-2019

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started