• Michael Meierruth (12/18/2014)


    Eric M Russell (12/17/2014)


    DonlSimpson (12/17/2014)


    As a side note, on some RDMS platforms, various stubbed values are treated literally as NULL. For example, Oracle treats an empty string as NULL.

    What this means is that ...

    '' is null : TRUE

    'Smith' > '' : FALSE

    '' = '' : FALSE

    I discovered that the hard way when working on a project that exchanged data between SQL Server and Oracle.

    Oracle does have an interesting concept of null. Thus all of these return 'ac':

    select replace('abc','b','') from dual;

    select replace('abc','b',null) from dual;

    select 'a'||null||'c' from dual;

    But this returns null:

    select 1+null+3 from dual;

    Regarding Oracle, one consequence is that an empty string is not equal to another empty string (because it's considered NULL). For example, if MIDDLE_NAME= '', a query WHERE MIDDLE_NAME = '' will not return a positive match.

    Many times in SQL Server, we populate a varchar columns with an empty string specifically to differentiate it from NULL. That's what tripped me up when porting a database and some SQL to Oracle.

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho