Skip to Content
0

HANA IFNULL FUNCTION DOUBT

May 22, 2017 at 06:39 PM

187

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
FILIPE Rebollo May 25, 2017 at 06:40 PM
0

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.

Share
10 |10000 characters needed characters left characters exceeded