Skip to Content
-1

HOW TO USE NULL IN ELSE PART IN SAP HANA?

Hi Experts,

I have a requirement to use null in else part of if condition.

Code:

CREATE PROCEDURE "KABIL_PRACTICE"."PROC_ELSE_NULL"(IN VAL1 INTEGER)
AS
BEGIN
IF :VAL1 >= 5 and :VAL1 <= 10
THEN
INSERT INTO "KABIL_PRACTICE"."ELSE_NULL" VALUES (:VAL1);
ELSE
NULL;
END;

but the above code throws an error in null line.

any suggestions please..??

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Jan 29 at 05:54 AM

    Just writing NULL in the else case does not make sense very much and this causes the error, because you have no valid syntax with that.

    The question is what you really wanna do if your condition is not fulfilled? Do you wanna do nothing, then just remove the else case. If you wanna insert a Null value in your table than do the insert statement with a Null value (of course the table column needs to accept Null values).

    Regards,
    Florian

    Add comment
    10|10000 characters needed characters exceeded

    • Syntax is not the same on Oracle and HANA. So no 1:1 copy and paste is possible.

      So you should know what the Oracle coding do, to be able to re-implement it on HANA. My two questions from above remain, and I think if you answer the question yourself you have the solution.