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

相关推荐
snow@li40 分钟前
数据库:市场中都有哪些数据库 / 优缺点 使用情况
数据库
NoSi EFUL1 小时前
MySQL中ON DUPLICATE KEY UPDATE的介绍与使用、批量更新、存在即更新不存在则插入
android·数据库·mysql
河阿里1 小时前
SQL数据库:五大范式(NF)
数据库·sql·oracle
l1t2 小时前
DeepSeek总结的PostgreSQL 19查询提示功能
数据库·postgresql
chenxu98b4 小时前
MySQL如何执行.sql 文件:详细教学指南
数据库·mysql
刘晨鑫14 小时前
MongoDB数据库应用
数据库·mongodb
梦想的颜色4 小时前
mongoTemplate + Java 增删改查基础介绍
数据结构·数据库·mysql
小小小米粒5 小时前
redis命令集合
数据库·redis·缓存
herinspace5 小时前
管家婆实用贴-如何分离和附加数据库
开发语言·前端·javascript·数据库·语音识别
步辞6 小时前
Go语言怎么用channel做信号通知_Go语言channel信号模式教程【完整】
jvm·数据库·python