
Inline adoc files when they are included exactly once. Also fix language tags because this inlining gives us better information on what language the code is written in.
70 lines
1.4 KiB
Plaintext
70 lines
1.4 KiB
Plaintext
== Why is this an issue?
|
|
|
|
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++``:
|
|
|
|
[source,cobol]
|
|
----
|
|
EXEC SQL
|
|
SELECT
|
|
PROD_ID,
|
|
NAME
|
|
INTO
|
|
:P-ID,
|
|
:P-NAME -- Noncompliant; No null indicator
|
|
FROM PRODUCT
|
|
END-EXEC
|
|
----
|
|
|
|
|
|
=== Compliant solution
|
|
|
|
[source,cobol]
|
|
----
|
|
EXEC SQL
|
|
SELECT
|
|
PROD_ID,
|
|
NAME
|
|
INTO
|
|
:P-ID,
|
|
:P-NAME :P-NAME-NULL -- Compliant
|
|
FROM PRODUCT
|
|
END-EXEC
|
|
----
|
|
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
=== Message
|
|
|
|
Add a null indicator for "xxx"; it is nullable.
|
|
|
|
|
|
=== Highlighting
|
|
|
|
Host variable
|
|
|
|
|
|
'''
|
|
== Comments And Links
|
|
(visible only on this page)
|
|
|
|
=== on 17 May 2016, 20:59:42 Ann Campbell wrote:
|
|
https://www.ibm.com/support/knowledgecenter/SSEPGG_9.5.0/com.ibm.db2.luw.apdv.embed.doc/doc/t0005636.html
|
|
|
|
endif::env-github,rspecator-view[]
|