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
----


ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)

include::comments-and-links.adoc[]
endif::env-github,rspecator-view[]
