Works!!! Only with that: BigDecimal bigDecimal = result.getBigDecimal(2);
Tank you for your help! On 15 Jan., 14:34, Jochen Schreiber <[email protected]> wrote: > Which version did you have? I downloaded the latest version 1.3.164 > > session.connection().createStatement().executeUpdate("drop table > hts.test1;"); > session.connection().createStatement().executeUpdate("CREATE TABLE > HTS.TEST1(ID BIGINT, ZEIT DECIMAL(12,11));"); > session.connection().createStatement().executeUpdate("INSERT INTO > HTS.TEST1 (ID, ZEIT) VALUES (1,0.00000000008);"); > session.connection().createStatement().executeUpdate("INSERT INTO > HTS.TEST1 (ID, ZEIT) VALUES (2,0.000008);"); > ResultSet rs = > session.connection().createStatement().executeQuery("select * from > hts.test1;"); > while (rs.next()){ > System.out.println("Test: " + rs.getObject("zeit")); > > } > > Test: 8E-11 > Test: 0.00000800000 > > On 15 Jan., 14:30, Christoph Läubrich <[email protected]> wrote: > > > > > > > > > It works with as many zeros as you like (well I think theres is a limit > > somewhere in h2): > > > Statement stm = connection.createStatement(); > > stm.executeUpdate("CREATE TABLE TEST1(ID BIGINT, ZEIT DECIMAL(12,11))"); > > stm.executeUpdate("INSERT INTO TEST1 (ID, ZEIT) VALUES (1, 0.00000000008)"); > > ResultSet result = stm.executeQuery("SELECT * FROM TEST1"); > > while (result.next()) { > > BigDecimal bigDecimal = result.getBigDecimal(2); > > System.out.println(result.getObject(1) + " = " + > > bigDecimal.toPlainString()); > > > } > > > results in: > > 1 = 0.00000000008 > > > Am 15.01.2012 14:25, schrieb Jochen Schreiber: > > > > Thats the testcase...:-) > > > > Your code work well but i have an zero more in my insert statement but > > > the field definition has to work for it too or? > > > > On 15 Jan., 14:20, Christoph L�ubrich<[email protected]> wrote: > > > >> Sorry I don't get it... thats the correct result... > > >> First ou write the data does not get inserted. > > >> Then it is inserted but as zero. > > >> Then it is inserte correctly but read back as wrong value. > > >> And now you show your problem with a testcase that yields correct > > >> results. > > > >> Please try to send (reproducable) testcase with acual data you are using > > >> + the result otherwhise its not possible to se what the (real) problem is -- 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.
