我有一个外部 csv 文件,其中包含要插入的数据。我的一列是数据类型时间戳(但它是一个可以为空的列)。数据值为 NULL/null 最终会出现以下异常。
Caused by: liquibase.exception.DatabaseException:
org.h2.jdbc.JdbcBatchUpdateException: Cannot parse "TIMESTAMP" constant ; SQL statement:
Run Code Online (Sandbox Code Playgroud)
我调试以查看生成的插入语句,当我进入 JdbcPreparedStatement 类时,CommandInterface 似乎具有空的 "" 字符串值而不是 NULL。
编辑: 偶然地,我试图在我的 liquibase 脚本中设置列的数据类型(可以有 NULL)并解决了这个问题。
小智 5
我使用的是 liquibase 3.5.5 版,并且在我的 csv 中使用“NULL”对我有用
示例 liquibase 文件:
id,field1,field2,field3
11,NULL,NULL,test
Run Code Online (Sandbox Code Playgroud)
将导致分别将 NULL 值插入 field1 和 field2。
| 归档时间: |
|
| 查看次数: |
2825 次 |
| 最近记录: |