G-2150
🆓Error
Avoid comparisons with NULL value, consider using IS [NOT] NULL.
Reason
The null
value can cause confusion both from the standpoint of code review and code execution. You must always use the is null
or is not null
syntax when you need to check if a value is or is not null
.
Example
Non-Compliant Example
declare l_value integer; begin if l_value = null then null; end if; end; /
Issues
Line | Column | Message |
---|---|---|
4 | 7 |
★★★★★
Compliant Solution -
declare l_value integer; begin if l_value is null then null; end if; end; /
Parameters
Use parameters to customize the rule to your needs.
Parameter | Description | Default Value |
---|---|---|
DisableAllQuickFix | Comma-separated ist of rules for which a quick fix should not be applied to all the problems in a file. | Core G-3130 |
References
- same as plsql:NullComparison
- same as plsqlopen:ComparisonWithNull
- same as Trivadis G-2150
- same as SQLFluff convention.is_null