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)
from: 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:
Entity integrity error
Your foreign key FK_ANDON_EVENT_STATUS will be wrong if there is no data in the column of the corresponding parent table, you should insert the parent table first, then insert the child table
Table a has a foreign key, pointing to table b, then b is the parent table of a, the foreign key refers to the column is the parent key
Read More:
- [Solved] Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database!
- [Solved] Cause: java.sql.SQLException: TDengine ERROR (8000000b): Unable to establish connection
- Mybatis Error: Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, expect EQ
- Mybatis Connect Database Error: Error querying database. Cause: java.sql.SQLException: The server time zone value..
- [Solved] ORA-21525: attribute number or (collection element at index) string violated its constraints
- “Error 0162 – Setup data integrity check failure” after updating BIOS via Thinkvantage
- [Solved] Flutter SDK constraint error: pub get failed (65; See…
- [Solved] Excel solver: Error Log 3_Decimal result after non negative constraint
- [Solved] Violation of check constraint (GYPTS.SYS_C0016857)
- [Solved] Failed to bind properties under ‘spring.datasource.type‘ to java.lang.Class<javax.sql.DataSource>
- Kettle Error Caused by: java.lang.ArrayIndexOutOfBoundsException
- Hive ERROR Failed with exception java.io.IOException:java.lang.IllegalArgumentException
- [Solved] java.lang.reflect.InaccessibleObjectException: Unable to make protected java.net.http.HttpRequest()…
- Flink SQL contains aggregation operators Error: you cannot print directly
- [Solved] Response Export error on submit request on future invoke, java.lang.OutOfMemoryError: Java heap space
- PgSQL associated tables perform update to avoid using in query SQL
- [Solved] spring boot – JPA–H2 Error: H2 error: “Syntax error in SQL statement … expected identifier“
- Idea Error: java: java.lang.OutOfMemoryError: GC overhead limit exceeded
- [Solved] IDEA Error: java: Compilation failed: internal java compiler error
- ORA-12505 error when java connects to oracle database