Saturday, July 14, 2007

Difference between empty string and null in Oracle Database

In Oracle, when we store a empty string i.e. "" through JDBC, then Oracle stores it as a NULL value. This causes a lot of confusion to Java developers. In Java a null and a "" are 2 different entities.

Hence even if you store an "" string when inserting into the database, when you retrieve the results, you would get the string as null.

If we do a getInt(), getFloat() etc. then we would get 0.