my dog learned polymorphism
The moose likes JDBC and Relational Databases and the fly likes I need to insert null in NUMBER field which is nullable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "I need to insert null in NUMBER field which is nullable" Watch "I need to insert null in NUMBER field which is nullable" New topic
Author

I need to insert null in NUMBER field which is nullable

lalitha prasad
Greenhorn

Joined: Aug 28, 2004
Posts: 16
Hi,

I need to do the following.

pst.setInt(1,null);

Is it possible?.

If anyone knows please help me.

thanks in advance,
LALITH
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
I guess the following might work.

PreapredStatement.setNull()

public void setNull(int parameterIndex, int sqlType) throws SQLException
Sets the designated parameter to SQL NULL.


Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Ed Wallen
Ranch Hand

Joined: Feb 11, 2002
Posts: 34
Call the setNull method on your prepared statement object (in your case, "pst") and pass it the appropriate type (in your case Types.INTEGER).


pst.setNull(index, Types.INTEGER);

-Ed
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: I need to insert null in NUMBER field which is nullable
 
It's not a secret anymore!