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

相关推荐
wWYy.10 分钟前
Mysql:主键索引 唯一索引 普通索引 前缀索引
数据库·mysql
宝杰X732 分钟前
Android Room3 多平台数据库
android·数据库
sky_8106134 小时前
Oracle ERP 各模块业务管理功能及底层表说明
数据库·oracle
YMatrix 官方技术社区5 小时前
CittaBase vs. Neo4j :原生图性能实测与混合检索实践
数据库·功能测试·ymatrix
闲猫6 小时前
LangChain / Integrations / Integrations by component / Tool
java·数据库·langchain
xqqxqxxq6 小时前
SQL 连接查询技术笔记
数据库·笔记·sql
Databend7 小时前
从万亿级大模型到全线应用:Databend Cloud 助力头部 AI 企业构建全链路 Trace 数据管道
大数据·数据库·sql
MC皮蛋侠客7 小时前
SQLAlchemy 系列(十一):从 1.x 到 2.x——渐进迁移与数据访问层治理
数据库·python
1001101_QIA7 小时前
工控机网络配置
开发语言·数据库·php