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

相关推荐
秦jh_15 分钟前
【Redis】Set和Zset
数据库·redis·缓存
what_201821 分钟前
PostgreSQL 时间
数据库·postgresql
Nyarlathotep011334 分钟前
Redis的数据结构(4):跳表
数据库·redis
☆56640 分钟前
如何为开源Python项目做贡献?
jvm·数据库·python
Bdygsl42 分钟前
MySQL(5)—— 聚合查询/分组查询/联合查询
数据库·mysql
m0_560396471 小时前
使用Python进行PDF文件的处理与操作
jvm·数据库·python
lhbian1 小时前
开启mysql的binlog日志
数据库·mysql
NineData1 小时前
从个人开发到企业专属集群,NineData 的产品矩阵怎么做的?
运维·数据库·程序员
2301_816651221 小时前
用Python监控系统日志并发送警报
jvm·数据库·python