I have a difficult issue with the Oracle jdbc driver's code So when I put something in Here, the constant This is a workaround: edit : The reason for these obstacles is that it is not possible Edit Because I ask about the developer's approach to this question, a database intangible library So my needs are to provide a very common solution that does not break anything in Juke's client code, this is the reason why I am not really a big fan of the solution. And that's why I do not have access to that What would you do instead? If you want , please try CHAR handling data types. Take simple table:
make table x (c char (4)); Insert in X (C) values ('A'); - Inserted 'A'
CHAR (4) , the string always gets filled with white space. Is when I execute a query like this:
select
from x where c = 'a'; - 1 selection of records * from x where c = 'a'; - 1 selection of records * from x where c = 'a'; - 1 selects the record
'a' is also full of whitespace, which is why the record always comes back. This is true when these questions are executed simultaneously with a JDBC
created location Now the hard thing is that when I want to use a bind variable: < Pre class = "lang-java prettyprint-override">
created statement stmt = conn.prepareStatement ("x * from * select c =?"); Stmt.setString (1, "A"); // It will not return any record stmt.setString (1, "A"); // This will return a record stmt.executeQuery ();
created condition stmt = conn.prepareStatement ("From X Choose * where trim (c) = trim (?) "); Stmt.setString (1, "A"); // This will return a record stmt.setString (1, "A"); // This will return a record stmt.executeQuery (); Edit : These barriers are now:
C and
? , and it's hard to use indexed on
c .
CHAR <
CHAR column announcement. But still, I want to be able to handle this issue.
stmt.setString (1, "a"); // This will not return a record
conn.prepareStatement ("Select * from x * c = cast (? Four (four)) ")
Comments
Post a Comment