• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Supressing Null column in a Result Set

 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This topic is usually discussed on the JDBC forum. Moving.
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Happily living in the valley of the dried frogs with a few tiny ads.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic