Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

ORA-02291: integrity constraint violated - parent key

DevguyApr 8 2011 — edited Apr 8 2011
When i am trying to insert values into a table i am getting integrity constraint violated error
kindly suggest me where i am doing wrong
SQL> insert into customers_products values(&tid,&cno,&pno,'&date',&qty);
Enter value for tid: 8200
Enter value for cno: 3001
Enter value for pno: 6000
Enter value for date: 11-feb-2010
Enter value for qty: 10
old   1: insert into customers_products values(&tid,&cno,&pno,'&date',&qty)
new   1: insert into customers_products values(8200,3001,6000,'11-feb-2010',10)
insert into customers_products values(8200,3001,6000,'11-feb-2010',10)
*
ERROR at line 1:
ORA-02291: integrity constraint (SCOTT.FK_CUSTOMERS) violated - parent key not found
here is the customers table
SQL> select * from customers;

CUSTNO FIRST_NAME                     LAST_NAME                      C CREDIT_LIMIT CREDIT_CARD_NO CREDIT_C
------ ------------------------------ ------------------------------ - ------------ -------------- --------
  3001 Jean                           Livingston                     E         ####           #### Standard
  3002 Kimberely                      Grant                          A         ####           #### Premium
  3003 Charles                        Johnson                        I         ####           #### Charge
  3004 Winston                        Taylor                         R         ####           #### Limited
  3005 Jean                           Paul                           B         ####           #### I
  3006 Martha                         Sullivan                       E         ####           #### Prepaid

6 rows selected.
This post has been answered by Toon Koppelaars on Apr 8 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 6 2011
Added on Apr 8 2011
11 comments
399 views