A
Alex Kizub
sqls:
CREATE TABLE table1
(
text CHAR(2)
);
insert into table1 values('A');
select text from table1 where text='A'; // A without space
select text from table1 where text='A '; // A+space
both selects bring 'A ' // A+space
Java:
ResultSet rs = stmt.executeQuery("select text from table1 where
text='A'");
brings the same 'A ' // A+space
PerparedStatement ps=con.prepareStatement("select text from table1
where text='A'"); // A without space
brings the same 'A ' // A+space
ps=con.prepareStatement("select text from table1 where text=?"); //
parameter
ps.setString(1,"A "); // A+space
brings, of course, the same 'A ' // A+space
ps.setString(1,"A"); // A without space
brings nothing
Any suggestions except make text match length of the database field
which makes application schema dependent?
CREATE TABLE table1
(
text CHAR(2)
);
insert into table1 values('A');
select text from table1 where text='A'; // A without space
select text from table1 where text='A '; // A+space
both selects bring 'A ' // A+space
Java:
ResultSet rs = stmt.executeQuery("select text from table1 where
text='A'");
brings the same 'A ' // A+space
PerparedStatement ps=con.prepareStatement("select text from table1
where text='A'"); // A without space
brings the same 'A ' // A+space
ps=con.prepareStatement("select text from table1 where text=?"); //
parameter
ps.setString(1,"A "); // A+space
brings, of course, the same 'A ' // A+space
ps.setString(1,"A"); // A without space
brings nothing
Any suggestions except make text match length of the database field
which makes application schema dependent?