IntelliJ Java IDE
The moose likes JDBC and the fly likes URGENT : Prepared Statement  Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JDBC
Reply Bookmark "URGENT : Prepared Statement  Problem " Watch "URGENT : Prepared Statement  Problem " New topic
Author

URGENT : Prepared Statement Problem

Sandeep Pai
Greenhorn

Joined: Aug 08, 2001
Posts: 2
I'm using a prepared stmt as follows :
PreparedStatement stmt = conn.prepareStatement("select CUSTOMER,BILLED_ID,DEVICE_ID,TO_CHAR(CALL_DATE,'MM/DD/YYYY') as CALL_DATE,SECOND_NUMBER,DATA_SIZE,RATE_PLAN,US_CALL_TYPE,ACTUAL_SERVICE_TYPE1,ACTUAL_SERVICE_TYPE2 from RA_RATED_USAGE where CUSTOMER = ? ");
stmt.setString(1,"reg");
I'm getting 0 rows returned.
But if I use
PreparedStatement stmt = conn.prepareStatement("select CUSTOMER,BILLED_ID,DEVICE_ID,TO_CHAR(CALL_DATE,'MM/DD/YYYY') as CALL_DATE,SECOND_NUMBER,DATA_SIZE,RATE_PLAN,US_CALL_TYPE,ACTUAL_SERVICE_TYPE1,ACTUAL_SERVICE_TYPE2 from RA_RATED_USAGE where CUSTOMER like ? ");
stmt.setString(1,"reg%");
I'm getting a number of rows returned.
In the database, all the rows have customer = "reg" and not "regard" or "reggie" or any name with an extension to reggie.
Can someone please help me out in this strange problem?
Regards,
Sandeep Pai.
Rajendar
Greenhorn

Joined: Feb 28, 2002
Posts: 9
There may be leading spaces after 'reg'.first try to trim it in the database and then try retrieving tehm.it may return rows..


Raj
 
 
subject: URGENT : Prepared Statement Problem
 
Threads others viewed
SQLException Cursor Closed
Convert Date with to_char() in a select statement
Prepared Statement and Date class - Problem still exists
Invalid Oracle URL specified
Prepared Statement and Date class
developer file tools