Hi all,
I'm trying to display the output of a resultset in a tabular manner on the screen .However , I have a problem where , a value that is null is displayed as 0.0 or 0 as the resultset methods(getFloat and getInteger) are of return type float or int and not Float or Integer .
To provide an example
Is there any other method I should be invoking in order to display the null as blank rather than a default value.?
Thank you .
Learning and Learning!-- Java all the way!
Sudheer Bhat
Ranch Hand
Joined: Feb 22, 2011
Posts: 75
posted
0
With getInt() or getFloat its not possible. These methods return 0 if the database value is NULL (its documented in the Resultset interface). If you want blank to be displayed in these columns, then you probably need to put a blank string in there.
Sudheer Bhat wrote:With getInt() or getFloat its not possible. These methods return 0 if the database value is NULL (its documented in the Resultset interface).
It is very much possible. See the ResultSet.wasNull() method. All what is needed here is to call the wasNull() method after getInt()/getFloat() and re-set obtained value to null if wasNull() returns true.