oracle报错 ORA-02290: 违反检查约束条件问题

保存数据库信息时,提示违反检查约束条件,如图:

org.springframework.dao.DataIntegrityViolationException: ### Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02290: 违反检查约束条件 (MXUSER.SYS_C0014712) ### The error may exist in com/btdl/bussiness/mapper/wisdomMonitoring/RewardPunishMapper.java (best guess) ### The error may involve com.btdl.bussiness.mapper.wisdomMonitoring.RewardPunishMapper.insert-Inline ### The error occurred while setting parameters ### SQL: INSERT INTO UC_REWARD_PUNISH ( id, class_id, major_code, type, notify_date, content, amount, score, assessor, description, editor, edit_time ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) ### Cause: java.sql.SQLIntegrityConstraintViolationException: ORA-02290: 违反检查约束条件 (MXUSER.SYS_C0014712) ; ORA-02290: 违反检查约束条件 (MXUSER.SYS_C0014712) ; nested exception is java.sql.SQLIntegrityConstraintViolationException: ORA-02290: 违反检查约束条件 (MXUSER.SYS_C0014712)

直接上解决方案:

1、查询该表的约束条件

复制代码
select * from user_constraints where table_name='TABLENAME',(这里要注意TABELNAME必须是大写)

TABELNAME为你的表名

2、发现该字段的约束条件,SYS_C0014712

删除该约束条件:

复制代码
ALTER TABLE TABLENAME DROP CONSTRAINT SYS_C0014712。【注:这里不需要使用引号】

刪除SYS_C0014712这个标识,可以通过报错信息就可以获取,然后执行报下一个约束错误进行同样操作。

相关推荐
SelectDB13 小时前
让变更流出 Doris:Apache Doris 5.0 基于增量计算的 CDC 技术解析
数据库
这个DBA有点耶13 小时前
MCP隔离层+行级语义审计+输出校验:AI访问数据库的安全边界拆解
数据库·人工智能·ai编程
这个DBA有点耶14 小时前
从反向扫描O(n)到正向扫描O(1):降序索引的物理机制与混合排序匹配规则
数据库
2501_9339232515 小时前
解读Redis:单线程模型
数据库·redis·缓存
Tapdata16 小时前
被忽略的第三类上下文:Agent 进入真实业务后,还缺什么?
数据库·人工智能·架构
小科先生17 小时前
Java springboot调用数据库的基本流程
java·数据库·spring boot
星恒随风17 小时前
MySQL 从零入门(四):表的增删改查与基础查询详解
linux·服务器·数据库·笔记·mysql
Pniubi19 小时前
MySQL靠什么实现事务的?事务隔离级别有哪些?
java·数据库·mysql
数据库小学妹20 小时前
pgbouncer 事务池:prepared statement、临时表与会话状态
数据库·后端·postgresql
Lucifer三思而后行21 小时前
最近折腾了一下金仓数据库的备份恢复
数据库·备份恢复