How is it possible to insert a NULL into an ORACLE TABLE when host variable has been initialized?


To achieve this goal, you have to use indicator variables:

  *Put a NULL value in a record using indicator variables
    move 6      to V-KEY
    move spaces to V-DATA
    move -1     to IND-VAR
    EXEC SQL 
       INSERT INTO V_TABLE VALUES (:V-KEY, :V-DATA:IND-VAR) 
    END-EXEC
When the value of the indicator variable is equal to -1, the value of the host variable is ignored and NULL will be used instead.

More information related to indicator variables is available in the isCOBOL documentation's Language Reference Manual in the "Embedded SQL: Indicator Variables" chapter.



Article ID: 221
Created: November 22, 2013
Last Updated: April 12, 2024
Author: Support KB Author

Online URL: https://support.veryant.com/phpkb/article.php?id=221