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