Set string for char DB column in prepared statement

This is my code and i have a column which is named as Product Id and data type as CHAR (6 byte) in oracle. I have used set string method for this column to retrieve the details from Database. Actually i got result set as false (It has empty) and there is no records fetched. But when am using ‘PRODUCT_ID=”+value+”‘ it works. How to fix this..

sSQL=”SELECT * FROM CART_VIEW WHERE PRODUCT_ID=? AND PRODUCT_NAME=? “;
ps=conn.prepareStatement(sSQL);
ps.setString(++i, sProductId);
ps.setString(++i, sProductName);
rs=ps.executeQuery();


Source: oracle

Leave a Reply