Handling nulls in Java

Is there a way we can convert a null string that we get from a Database to maybe something like a space.Please let me know urgentlythanks
[165 byte] By [neelmukherjee] at [2007-9-26 3:34:11]
# 1

When using Oracle, I use the decode funvtion to do it.

select decode(a, null, ' ', a), b, c from t1 where d = 10;

The first column in the selected resultset will be a space if the database column in null.

Is that what you wanted ?

I am not aware whether decode is part of standard SQL though.

neville_sequeira at 2007-6-29 12:03:23 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2
just posted this for another thread on the same topic: http://forum.java.sun.com/thread.jsp?forum=48&thread=158508&start=0&range=15#467357Jamie
jlrober at 2007-6-29 12:03:23 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3

>...from a Database to maybe something like a space

That might not be a good idea.

Doing that means that when you put data back into the database you must trim every value and then check to see if it is an empty string. If it is empty then you have to set the field to null.

jschell at 2007-6-29 12:03:23 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...