SQL Error: ORA-02291: integrity constraint
Try inserting in your TypeComponent
table first, then insert into your Component
table.
According to the 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.
This means that there is no matching key in your referenced table.
EDIT #1
For your kind information, here is a site where you can get help with all of the Oracle error codes.
http://[ora-02291].ora-code.com/
Here's the homepage for this site: http://www.ora-code.com/
Where you may replace the error code in the URL to suit the error code you're getting, and you'll access to the page for this error.
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-02291: integrity constraint violated - parent key not found
The value inserted into the book_id column of the Review table should be in the Book Table.If not, it throws an error like this.
Why am I violating an integrity constraint? (ORA-02291)
You need the "Marvel: Iron Man" franchise to exist before you insert "Iron Man" into Movie
.
Also, you should always use explicit column names in INSERT
statements.
INSERT INTO Franchise ( Fran_Name )
VALUES ( 'Marvel: Iron Man' )
INSERT INTO Movie ( Movie_Title, Screen_Time, M_Reviews, Fran_name )
VALUES( 'Iron Man 2', 124, 7.0, 'Marvel: Iron Man' );
...and more controversially, I feel database tables should have plural names if the table represents an unbounded collection. (I look forward to the dozen or so comment replies from people who disagree ;) )
Related Topics
Sqlite Inner Join - Update Using Values from Another Table
Oracle Convert Timestamp with Timezone to Date
Auditing SQL Server Data Changes
SQL Pivot with Multiple Columns
MySQL Bulk Load Command Line Tool
How to Return Default Value from SQL Query
How to Execute SQL Query Without Displaying Results
SQL Table Aliases - Good or Bad
How to Get the Last Day of Month in Postgres
Is There a Severe Performance Hit for Using Foreign Keys in SQL Server
Rodbc SQLquery() Returns Varchar(255) When It Should Return Varchar(Max)
How to Read Multiple Result Sets Returned from a SQL Server Stored Procedure in R
R Equivalent of Select Distinct on Two or More Fields/Variables
Rodbc Loses Time Values of Datetime When Result Set Is Large
How to Use Parameters with Rpostgresql (To Insert Data)
Writing Unicode from R to SQL Server