• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to set a null and how to retrieve it  RSS feed

 
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hai,
how to set a null values into a table and
how to retrieve the null values from the table

i used the methods
setNull() and getNull() i am not getting
please solve my query with example..

thank Q

bye.
 
Bartender
Posts: 2633
17
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To set null values:
PreparedStatement.setNull().

To check null values: ResultSet.wasNull().

Regards, Jan
[ April 24, 2007: Message edited by: Jan Cumps ]
 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



To check null values: ResultSet.wasNull().



ResultSet's wasNull only checks if last column read was Null
Better and scalable approach is always to write a utility class for checking null value and check the value returned against it
e.g. You wrote Util.java and one of the methods is
boolean isNull(Object obj)

then simply use it and you will know if the value returned is Null or not
[ April 24, 2007: Message edited by: Gaurav Chikara ]
 
The harder I work, the luckier I get. -Sam Goldwyn So tiny. - this ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!