How do you guys treat empty strings with Oracle?
Statement #1: Oracle treats empty string (e.g. ”) as NULL in ‘varchar2’ fields.
Statement #2: We have a model that defines abstract ‘table structure’, where for we have fields, that can’t be NULL, but can be ’empty’. This model works with various DBMS; almost everywhere, all is just fine, but not with Oracle. You just can’t insert empty string into a ‘not null’ field.
Statement #3: non-empty default value is not allowed in our case.
So, would someone be so kind to tell me – how can we resolve it?
This is why I’ve never understood why Oracle is so popular. They don’t actually follow the SQL standard, based on a silly decision they made many years ago.
The Oracle 9i SQL Reference states (this has been there for at least three major versions):
But they don’t say what you should do. The only ways I’ve ever found to get around this problem are either: