Ajay Kumar
Ajay Kumar

Reputation: 5233

Caused by: org.h2.jdbc.JdbcSQLException: Function "TO_TIMESTAMP" not found; SQL statement:

Can someone help me out here- getting following errors while running DML commands.

Caused by: org.h2.jdbc.JdbcSQLException: Function "TO_TIMESTAMP" not found; SQL statement:

Upvotes: 3

Views: 8276

Answers (2)

ihebiheb
ihebiheb

Reputation: 5173

I had a similar exception (org.h2.jdbc.JdbcSQLSyntaxErrorException: Function "TO_TIMESTAMP" not found) when upgrading h2 from 1.4.2 to 2.2.202

I don't know why, but it appears that the function had been removed

To make it work, I replaced to_timestamp by parsedatetime

parsedatetime follow the java.text.SimpleDataFormat semantics


Edit : Another way would be to add compatibity mode to Oracle (Mode=Oracle):

Example in spring boot : https://stackoverflow.com/a/64799048/1546137

Upvotes: 4

Ajay Kumar
Ajay Kumar

Reputation: 5233

Finally i got this answer, we were using older version of h2 database dependency in our project. for Quick fixed,Take out latest dependency and add in your pom.xml file.

<dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <version>1.4.195</version>
 </dependency>
  1. http://www.h2database.com/html/download.html
  2. https://mvnrepository.com/artifact/com.h2database/h2

Upvotes: 1

Related Questions