• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Supressing Null column in a Result Set

 
Bharadwaj Adepu
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
How can we suppress a Null column in a reslutset? I mean, suppose a table has three columns and only two columns has data and the third column is entirely Null, when i fetch the resultset, i get this null column also. But while using this result set i have to suppress the empty column. How can this be done?
While fetching from resultset, how can i know whether the entire column is null?
 
Aurelian Tutuianu
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While fetching from resultset, how can i know whether the entire column is null?

You don't.
The only way you can find if this happens is to execute a sql command which ask this specific question.
Something like: select count(*) from t where c3 is not null.

Anyhow, why would you want to do this? Because you spent very few resources to get a column with null values.
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This topic is usually discussed on the JDBC forum. Moving.
 
Paul Clapham
Sheriff
Posts: 21002
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't understand what you mean when you say "suppress" a column. If you want to skip certain code if something you read from a ResultSet is null, then an if-statement would do. Or maybe you need an SQL solution like what Aurelian posted. But in any case you need to explain your problem more clearly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic