• Post Reply Bookmark Topic Watch Topic
  • New Topic

URGENT : Prepared Statement Problem

 
Sandeep Pai
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There may be leading spaces after 'reg'.first try to trim it in the database and then try retrieving tehm.it may return rows..
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!