Error report - ORA-02291: integrity constraint violated - parent key not found
The constraints
CONSTRAINT downloads_fk FOREIGN KEY(user_id) REFERENCES users (user_id)
and
CONSTRAINT downloads_fk2 FOREIGN KEY(product_id) REFERENCES product(product_id)
means that the user_id
values 1 and 2, the product_id
values 1 and 2 which you are trying to insert into downloads
table must already exist in users
table and product
table.
If users
and product
tables are not populated with these values (1 and 2) before you insert those values into downloads
table, you will get this error as the integrity constraints will be violated.
You are creating an orphan record with no parent record. This is precisely what you were ensuring not to happen when you created those two constraints.