Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

PreparedStatement and empty String instead of space

843859Nov 13 2006 — edited Nov 24 2006
Hi all, I would test a space value in a varchar field, i.e.:

PreparedStatement ps=con.prepareStatement();
String qry = "select a from table where b=? and c=?";
ps.setString(1,"value");
ps.setString(2," "); // space!!

That source code doesn't work: it set "" (empty String) in the second field, not " " (space).

Can I use PrepareStatement in any way to do this or I have to use only Statement?

Thanks.

Bye.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 22 2006
Added on Nov 13 2006
28 comments
3,887 views