G-2330
🆓Error
Never use zero-length strings to substitute NULL.
Reason
Today zero-length strings and null are currently handled identical by the Oracle Database. There is no guarantee that this will still be the case in future releases, therefore if you mean null use null.
Example
Non-Compliant Example
create or replace package body constants_up is
function null_string return varchar2
deterministic
is
begin
return '';
end null_string;
end constants_up;
/Issues
| Line | Column | Message |
|---|---|---|
| 6 | 14 |
Compliant Solution - ★★★★★
create or replace package body constants_up is
function empty_string return varchar2
deterministic
is
begin
return null;
end empty_string;
end constants_up;
/Parameters
Use parameters to customize the rule to your needs.
| Parameter | Description | Default Value |
|---|---|---|
| DisableAllQuickFix | Comma-separated list of rules for which a quick fix should not be applied to all the problems in a file. | Core G-3130 |
References
- same as plsqlopen:EmptyStringAssignment
- same as Trivadis G-2330