Hi, Thank you for your quick response! Let me ask one more question.
When value 'A' set in the Column whose Data Type is defined as char(15), you get value 'A ' in native JDBC access(Oracle / SQLServer etc...) but you get the value in LinkedTable access, you just get 'A'. According to the manual (see : http://www.h2database.com/html/datatypes.html#chartype), H2 CHAR Type "ignores trailing spaces". I think CHAR Type Column adds trailing spaces to its length automatically and returns the padding value in general(Oracle / SQLServer etc...). So, the H2 CHAR Type definition("ignores trailing spaces") seems inconsistent with other RDBMSs. I would like to ask you why H2 CHAR Type is desigined like above. Sincerely, On Sep 20, 12:52 am, "Thomas Mueller" <[EMAIL PROTECTED]> wrote: > Hi, > > Thanks for you help! To me, it looks like a bug in Oracle. See below > for my test case. No other database I have tested behaves like that, > and I don't see a good reason why a database should. I'm almost sure > Oracle will not fix this (for whatever reason). There is a workaround, > and I will implement it in the next release. > > Regards, > Thomas > > public static void main(String[] args) throws Exception { > Class.forName("oracle.jdbc.driver.OracleDriver"); > Connection conn = DriverManager.getConnection( > "jdbc:oracle:thin:@192.168.0.103:1521:XE", "client", > "client"); > Statement stat = conn.createStatement(); > stat.execute("drop table test"); > stat.execute("create table test(id int primary key, name char(15))"); > stat.execute("insert into test values(1, 'Hello')"); > System.out.println("select * from test where name = 'Hello'"); > ResultSet rs = stat.executeQuery( > "select * from test where name = 'Hello'"); > while (rs.next()) { > System.out.println(" result: " + rs.getString(2)); > } > System.out.println( > "select * from test where name = ? -- where ? = \"Hello\""); > PreparedStatement prep = conn.prepareStatement( > "select * from test where name = ?"); > prep.setString(1, "Hello"); > rs = prep.executeQuery(); > while (rs.next()) { > System.out.println(" result: " + rs.getString(2)); > } > System.out.println( > "select * from test where name = ? -- where ? = > \"Hello \""); > prep = conn.prepareStatement( > "select * from test where name = ?"); > prep.setString(1, "Hello "); > rs = prep.executeQuery(); > while (rs.next()) { > System.out.println(" result: " + rs.getString(2)); > } > System.out.println( > "select * from test where name = cast(? as char(15)) > -- where ? = \"Hello\""); > prep = conn.prepareStatement( > "select * from test where name = cast(? as char(15))"); > prep.setString(1, "Hello"); > rs = prep.executeQuery(); > while (rs.next()) { > System.out.println(" result: " + rs.getString(2)); > } > conn.close(); > } > > The result I got is: > select * from test where name = 'Hello' > result: Hello > select * from test where name = ? -- where ? = "Hello" > select * from test where name = ? -- where ? = "Hello " > result: Hello > select * from test where name = cast(? as char(15)) -- where ? = "Hello" > result: Hello > > On Thu, Sep 18, 2008 at 10:45 AM, Toshiaki Takashima > > > > <[EMAIL PROTECTED]> wrote: > > > Hi, > > > It seems that CHAR column in Oracle Db(10g Express Edition Release > > 10.2.0.1.0) table can not be used when you use table through LinkedTable. > > > <<Example>> > > > Table definition : > > > CREATE TABLE TEST1 > > ( > > KEY1 VARCHAR2(20) NOT NULL, > > VALUE1 CHAR(15), > > CONSTRAINT TEST1_PK PRIMARY KEY (KEY1) > > ) > > > then, insert record such that : > > > insert into TEST1 values('data1', 'test1') > > > * the value 'test1' is converted to 'test1 ' > > because the data type of column 'VALUE1' is CHAR. > > > finally, create LinkedTable 'LINK_TEST1' (same name). > > > In this case, the following query to LinkedTable > > do not return any results. > > > 1) > > SELECT * FROM LINK_TEST1 > > WHERE VALUE1 = 'test1' > > > 2) > > SELECT * FROM LINK_TEST1 > > WHERE VALUE1 = 'test1 ' > > > It seems buggy. > > > Sincerely,- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/h2-database?hl=en -~----------~----~----~----~------~----~------~--~---
