【发布时间】:2019-01-20 09:37:08
【问题描述】:
我有这个代码:
try {
insertRowInDatabase();
} catch(SQLIntegrityConstraintViolationException e) {
//row already inserted. Do nothing.
} catch(Exception other) {
//we should retry to insert row
retry();
}
是否有可能,将行插入 oracle 数据库会引发 SQLIntegrityConstraintViolationException,但数据库中毕竟不存在该行。
【问题讨论】:
-
我有一个带有主键约束的表。不存在触发器或外键。
-
我的问题更多是关于Oracle数据库默认提供的一致性和隔离级别。与触发器和外键无关。