I am writing a Native SQL Stored Procedure for both Insert and Update.
In my program, I have two input variables 1) New User Name and 2) Old User NAme. If I get the Values in both the fields then my SP would update the DB2 Table with New User Name. If there are no values in the Old User Name then an Insertion would happen.
I hope we can use PARAMETER STYLE GENERAL WITH NULLS in Native SQL. But I am not sure where we declare the Parameter Null indicators for the INput values. In COBOL we have the Parameter NULL indicators in Linkage Section using which, we can validate for nulls.
Could you please let me know how to check the NULL indicators in Native SQL.
CREATE PROCEDURE EMP.NATIVE_SQL (
NEW_EMP_NAME IN CHAR(50)
, OLD_EMP_NAME IN CHAR(50)
WLM ENVIRONMENT PRODWLM
MODIFIES SQL DATA
PARAMETER STYLE GENERAL WITH NULLS
>> Checking for NEW_EMP_NAME for NULL would be suffice here. Please advise.
Joined: 23 Nov 2006 Posts: 19270 Location: Inside the Matrix
I believe one of us is confused. . .
If you want to check some value in the program (field n a file or working-storage etc) for "NULL", i know of no way to do this - there is no NULL value in the ebcdic value table. Every value from x'00' to x'FF' is valie and is NOT a null value.
If you want to insert a null value, you would set the null-indicator to -1 which tells sql this value is numm (contains no value at all).