【发布时间】:2022-02-18 02:33:57
【问题描述】:
有人能帮我解决吗?运行 DML 命令时出现以下错误。
原因:org.h2.jdbc.JdbcSQLException:找不到函数“TO_TIMESTAMP”; SQL语句:
【问题讨论】:
标签: h2
有人能帮我解决吗?运行 DML 命令时出现以下错误。
原因:org.h2.jdbc.JdbcSQLException:找不到函数“TO_TIMESTAMP”; SQL语句:
【问题讨论】:
标签: h2
最后我得到了这个答案,我们在项目中使用的是旧版本的 h2 数据库依赖项。 为了快速修复,取出最新的依赖项并添加到您的 pom.xml 文件中。
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.195</version>
</dependency>
【讨论】:
在将 h2 从 1.4.2 升级到 2.2.202 时,我遇到了类似的异常 (org.h2.jdbc.JdbcSQLSyntaxErrorException: Function "TO_TIMESTAMP" not found)
我不知道为什么,但似乎该功能已被删除
为了让它工作,我用parsedatetime替换了to_timestamp
parsedatetime 遵循java.text.SimpleDataFormat 语义
编辑:另一种方法是将兼容模式添加到 Oracle (Mode=Oracle):
spring boot 示例:https://stackoverflow.com/a/64799048/1546137
【讨论】: