Title: Oracle+CMP+Fixed length columns

Folks,

In Oracle, there is a PITA problem with prepared statements that forces you to right pad the value in a where clause arg  for fixed length fields. Example:

create table SOMETABLE
(
  SOMECOLUMN char(10)
)
// Assume this data
insert into SOMETABLE("FOO");

// And this code
PreparedStatement ps = conn.prepareStatement("select count(*) from SOMETABLE where SOMECOLUMN = ?");
ps.setString(1,"FOO");                 
ResultSet rs = ps.executeQuery();       << Will get count = 0

ps.setString(1,"FOO       ");           << Value rightpadded to size of DB col
ResultSet rs = ps.executeQuery();       << Will get count = 1


// But this
Statement st = conn.createStatement("select count(*) from SOMETABLE where SOMECOLUMN = 'FOO'");
ResultSet rs = st.executeQuery();       << Will get count = 1


Is there a provision for this (like a switch somewhere) in CMP, that allows one to pass a value (unmolested) to a finder method?

TIA


-----------------------
Mike Finn                              
Frontier Communications     
Rochester, NY                   
V: 585-777-8202
E: mailto:[EMAIL PROTECTED]


Reply via email to