Hi Thomas, Thanks for your response. When I check the changelog from h2database.com (http://www.h2database.com/html/changelog.html), the change that allows trunc for timestamp is included in the version 1.4.188 Beta. The problem I have is there in the version 1.4.189.
Regards Cédric Le mardi 22 septembre 2015 17:34:26 UTC+2, Thomas Mueller a écrit : > > Hi, > > There was a change recently that allows "trunc" for timestamps. Before > that change, it was just for numbers. That's why you need to specify the > data type now when using a parameter, for example trunc(cast(? as ...)). > > Regards, > Thomas > > On Monday, September 21, 2015, <[email protected] <javascript:>> wrote: > >> Hello, >> >> I have a problem when I'm updating the h2database version from 1.3.164 to >> 1.4.189. The problem also appear when I'm using the versions in-between. In >> our query, we use the TRUNC's result in a computation (see below): >> >> select * >> from tableA a >> where trunc(?1) < trunc(a.from) >> >> works well with all versions >> >> select * >> from tableA a >> where trunc(?1) - trunc(a.from) < 5 >> >> throw me an exception with the following message (except in the version >> 1.3.164 where it works well): "Unknown data type: "?"" >> >> More Information: >> - I had to create an alias for the TRUNC function in the version 1.3.164 >> and it worked well. The alias cannot be set in further version anymore. >> - I use openjpa 2.2.3-SNAPSHOT (Websphere 8.5) to execute the query >> (native) on the h2database. >> - I tried to set the parameter type and it did not help: >> nativeQuery.setParameter(4, sqlDate, TemporalType.TIMESTAMP); >> >> My question is: Why is h2database no more able to recognize the type of >> trunc? >> >> Thanks in advance. >> >> Kind regards >> >> Cédric >> >> -- >> You received this message because you are subscribed to the Google Groups >> "H2 Database" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/h2-database. >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
