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!

problem with null in prepared statement

843859Mar 22 2007 — edited Apr 17 2007
hi all,

i am getting some values from my jps page using request.getParameter("") and setting them in query in a servlet for fetching records from oracle db.

i have query something like this:

select product_id from product p, product_types pt where upper(pt.product_name) = nvl(?,upper(pt.product_name)).

if the user on jsp page doesn't input any product name then i m setting "null" explicitly.

but the real issue is how can i set ? to a null (not null string) (just like prepareStatement.setString (1,"abc");) because the query will return all the records if ? is set to null (not "null") and i want exactly that.

any hints???


regards
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 15 2007
Added on Mar 22 2007
14 comments
6,135 views