According to official 11g docs
Oracle Database currently treats a character value with a length of zero as null. However, this may not continue to be true in future releases, and Oracle recommends that you do not treat empty strings the same as nulls.
Consider a function getVersion
that returns a varchar2 that might possibly be ''
:
l_version := x.getVersion;
if l_version is null then
return 'V.1.0';
end if;
This will work correctly on current Oracle 11g, but might break as soon as future Oracle versions treat ''
differently than null
.
The only way I see to do the above future proof is:
if l_version is null or l_version = '' then
Is there a less cumbersome way?