Empty strings and NULLs
Depending on the context, an empty string ( ''
) can be considered as
NULL
or NOT NULL
.
At the SQL level, most databases distinguish ''
empty strings from
NULL
(with some exceptions like Oracle® DB). However, in programs, an empty string is the equivalent to
NULL
in program variables. As result, it is not possible to distinguish an empty
string from a NULL
when such values are fetched from the database.
This limitation is only visible when fetching VARCHAR
columns and expressions
fetched into VARCHAR
variables, because CHAR
columns get filled
with blanks if the database returns a CHAR
column value that was filled with an
empty string; CHAR
columns get blanks up to the max size.