java.sql.SQLException: ORA-02291: integrity constraint violated - par
2014-03-21 12:11
375 查看
java.sql.SQLException: ORA-02291: integrity constraint (BOOKER.FK_ANDON_EVENT_STATUS) violated - parent key not found
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:955)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316)
原因:http://www.dba-oracle.com/t_ora_02291_integrity_constraint_string_string_violated_parent_key_not_found.htm
The Oracle docs note this on the ora-02291 error:
ORA-02291: integrity constraint (string.string) violated - parent key not found
Cause: A foreign key value has no matching primary key value.
Action: Delete the foreign key or add a matching primary key.
For an insert statement, this ORA-02291 error is common when you are trying to insert a child without a matching parent, as defined by a foreign key constraint. In that case, you need to add the parent row to the table and then
re-insert your child table row.
See the dba_constraints view to find the parent table.
To fully understand [primary and foreign key constraints, see the book Easy Oracle Jumpstart, to explain these concepts:
实体完整性错误
你的外键FK_ANDON_EVENT_STATUS中对应的父表的列中没有相关数据就会出这错,应该先插入父表,再插子表
表a有一外键,指向表b,那么b就是a的parent table,外键所指的列就是parent key
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:112)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:331)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:288)
at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:743)
at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:216)
at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:955)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3316)
原因:http://www.dba-oracle.com/t_ora_02291_integrity_constraint_string_string_violated_parent_key_not_found.htm
The Oracle docs note this on the ora-02291 error:
ORA-02291: integrity constraint (string.string) violated - parent key not found
Cause: A foreign key value has no matching primary key value.
Action: Delete the foreign key or add a matching primary key.
For an insert statement, this ORA-02291 error is common when you are trying to insert a child without a matching parent, as defined by a foreign key constraint. In that case, you need to add the parent row to the table and then
re-insert your child table row.
See the dba_constraints view to find the parent table.
To fully understand [primary and foreign key constraints, see the book Easy Oracle Jumpstart, to explain these concepts:
实体完整性错误
你的外键FK_ANDON_EVENT_STATUS中对应的父表的列中没有相关数据就会出这错,应该先插入父表,再插子表
表a有一外键,指向表b,那么b就是a的parent table,外键所指的列就是parent key
相关文章推荐
- java.sql.BatchUpdateException: ORA-02291: integrity constraint
- java.sql.SQLIntegrityConstraintViolationException: ORA-02291
- 系统提示java.sql.SQLIntegrityConstraintViolationException: ORA-00001: 违反唯一约束条件
- java.sql.SQLException: ORA-02291: 违反完整约束条件 (BOOK.FK_USERNAME) - 未找到父项关键字
- java.sql.BatchUpdateException: ORA-00001: unique constraint (IEVSP.PK_C_CSERVICES) violated
- ORA-02291: integrity constraint (SYSTEM.FK1170E5C5328E4352) violated 解决办法
- ORA-02291: integrity constraint (INFORES_GZ_PJ2.FK_TC_DEV_PROPERTY_GRP_PROID) violated - parent key
- java.sql.SQLIntegrityConstraintViolationException: ORA-01400: 无法将 NULL 插入 (表)
- java.sql.SQLException: ORA-28009: connection as SYS should be as SYSDBA or SYSOPER
- java.sql.SQLException: ORA-01000: maximum open cursors exceeded
- java.sql.SQLException: ORA-01006: 赋值变量不存在
- java.sql.SQLException: ORA-01858: 在要求输入数字处找到非数字字符
- java.sql.SQLException: ORA-01729: 需要数据库链接名
- [异常解决]java.sql.SQLException: ORA-00947: not enough values
- java.sql.SQLException: ORA-01400: 无法将 NULL 插入 ("LVJIAN"."T_ITEMS"."ITEM_NAME")
- java.sql.SQLException:ORA-00923:未找到要求的From
- java.sql.SQLException: ORA-01000: 超出打开游标的最大数
- java.sql.SQLException: ORA-00911: invalid character 解决方法(转)
- exlipse 执行sql语句 报 java.sql.SQLException: ORA-01013 报错用户请求取消当前的操作
- Cause: java.sql.SQLException: ORA-01841: (完整) 年份值必须介于 -4713 和 +9999 之间, 且不为 0