Hi everyone, I am working on a project on JSP/Servlets with Oracle as the database. I have a field Custoner ID (char)(10)(PK) in the Customer table of the database. so now for e.g if the value is C001 there are 6 white spaces along with C001. So when i try to search the value C001 in SQL query, for e.g "select * from Customers where CustID = 'C0001'" But I do not receive any records matching with C001, coz in the database there is C001 and 6 white spaces Lemme know what is the solution to this.. Thanx in adv....
I think the best solution would be to get rid of the white space, but if you need it, change your SQL statement to "select * from Customers where CustID LIKE 'C0001%'" This will find all records that START with C0001. There may be better ways to do this in SQL, but not sure.
Are you using jdbc 'select' or Oracle SQL/plus 'select' In either case, the spaces should not matter, in my experience. What version of Oracle? I used only Oracle8i, jdbd sql statements and widely varying field lengths. Good luck.
Tom Hennigan<P>Sun Certified Java 2 Platform Programmer