G-2330: Never use zero-length strings to substitute NULL.

Major

Portability

Reason

Today zero-length strings and NULL are currently handled identical by ORACLE. There is no guarantee that this will still be the case in future releases, therefore if you mean NULL use NULL.

Example (bad)

1
2
3
4
5
6
7
8
9
create or replace package body constants is
   k_null_string constant varchar2(1) := '';

   function null_string return varchar2 is 
   begin
       return k_null_string;
   end null_string;
end constants;
/

Example (good)

1
2
3
4
5
6
7
8
create or replace package body constants is

   function empty_string return varchar2 is 
   begin
       return null;
   end empty_string;
end constants;
/