rules repository

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
LineColumnMessage
614Use NULL instead of zero-length string.

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

References