When a SELECT returns null from a nullable column, the relevant host variable isn’t updated; it simply retains its
previous value. The only way you’ll ever know the column value was null is to check the relevant null indicator included in the
SELECT for a negative (null) value.
This rule raises an issue when a SELECT omits a null indicator for a nullable column.
Note that this rule raises issues only when a database catalog is provided during the SonarQube analysis.
Noncompliant code example
With the table PRODUCT having a nullable column NAME:
EXEC SQL
SELECT
PROD_ID,
NAME
INTO
:P-ID,
:P-NAME -- Noncompliant; No null indicator
FROM PRODUCT
END-EXEC
Compliant solution
EXEC SQL
SELECT
PROD_ID,
NAME
INTO
:P-ID,
:P-NAME :P-NAME-NULL -- Compliant
FROM PRODUCT
END-EXEC