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)
CREATE OR REPLACE PACKAGE BODY constants_up IS
co_null_string CONSTANT VARCHAR2(1) := '';
FUNCTION null_string RETURN VARCHAR2 IS
BEGIN
RETURN co_null_string;
END null_string;
END constants_up;
/
Example (good)
CREATE OR REPLACE PACKAGE BODY constants_up IS
FUNCTION empty_string RETURN VARCHAR2 IS
BEGIN
RETURN NULL;
END empty_string;
END constants_up;
/