There’s no point in including the default value of a column in an insert statement. It simply clutters the code to no additional benefit.
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 column INV_COUNT
with default 0
:
EXEC SQL
INSERT INTO PRODUCT
(
NAME,
INV_COUNT -- Noncompliant
)
VALUES
(
:PROD-NAME,
0 -- this is the default value
)
END-EXEC
Compliant solution
EXEC SQL
INSERT INTO PRODUCT
(
NAME
)
VALUES
(
:PROD-NAME
)
END-EXEC