Skip to Content

HANA IFNULL FUNCTION DOUBT

I don't know if I understand the IFNULL function correctly but it seems that it is not working properly.

Here is my select statement:

SELECT LIFNR,IFNULL(STCD1,STCD2),STCD1,STCD2 FROM LFA1 WHERE "LIFNR" = '0009009005'

I would like to return the STCD2 value if STCD1 is null. In this sample the STCD1 is null and the function is not returning STCD2.

Am I missing anything?

Syntax

 IFNULL (expression1, expression2)

Description

Returns the first not NULL input expression.

  • Returns expression1 if expression1 is not NULL.
  • Returns expression2 if expression1 is NULL.
  • Returns NULL if both input expressions are NULL.

regards,

Filipe

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    May 25, 2017 at 06:40 PM

    Once the column STD1 is flagged as "NOTNULL" the actual value in it is empty not null. That's the reason why the function is not working in this case.

    Add comment
    10|10000 characters needed characters exceeded