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这个标识,可以通过报错信息就可以获取,然后执行报下一个约束错误进行同样操作。

相关推荐
刘~浪地球37 分钟前
Redis 从入门到精通(十):管道技术
数据库·redis·缓存
fzb5QsS1p4 小时前
MySQL 事务的二阶段提交是什么?
数据库·mysql
清风徐来QCQ7 小时前
Lombok/SSM/devTools
数据库
LaughingZhu7 小时前
Product Hunt 每日热榜 | 2026-04-05
前端·数据库·人工智能·经验分享·神经网络
2601_949814697 小时前
使用mysql报Communications link failure异常解决
数据库·mysql
搜佛说7 小时前
02-第2章-核心概念与架构
数据库·物联网·微服务·架构·边缘计算·iot
C'ᴇsᴛ.小琳 ℡9 小时前
高性能NoSQL
数据库·nosql
i220818 Faiz Ul10 小时前
动漫商城|基于springboot + vue动漫商城系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·动漫商城系统
iNgs IMAC10 小时前
redis 使用
数据库·redis·缓存
TDengine (老段)11 小时前
TDengine IDMP 可视化 —— 面板
大数据·数据库·人工智能·物联网·ai·时序数据库·tdengine