Discussion Locked

null and empty string

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
In oracle, if you have a varchar field which is set to '' - > empty string and the same is set = null . Please clarify whether in both the situation the value is one and the same or not? If not, why ?

2 replies

by aamir abbas

Zero-length string ('') and NULL are said to be identical in Oracle 7 documentation but still they suggested not to suppose these as equivalent values because in later version, these values will be having some difference.

Truly speaking, if you insert '' and NULL values in any VarChar2 column (I’ve tested this in Oracle 8i), they will still be listed under an identical condition (i.e. both will be considered as NULL while if you search for a value containing '', this will return no rows).

I suggest you to do not assign '' to any column, rather use NULL. Be careful using NULL values with numeric columns because this will evaluate all your arithmetic expressions as NULL until unless you use NVL function to eliminate it with some valid value.

Hopefully, you will get a way. Wish you a good luck.

This discussion is closed to new replies.