472,096 Members | 1,393 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,096 software developers and data experts.

How to solve ORA-02291: integrity constraint error

CREATE TABLE ORDER_PHARMACY(
Ord_ID VARCHAR2(10)
CONSTRAINT ORDER_PHARMACY_Ord_ID_pk PRIMARY KEY
CONSTRAINT Ord_ID_nn NOT NULL,
Ord_Date DATE DEFAULT SYSDATE
CONSTRAINT ORDER_PHARMACY_Ord_Date_nn NOT NULL,
Ord_Price VARCHAR2(10),
Ord_Qty NUMBER(10),
Emp_ID VARCHAR2(10)
CONSTRAINT ORDER_PHARMACY__Emp_ID_fk
REFERENCES EMPLOYEE(Emp_ID));


INSERT INTO ORDER_PHARMACY(Ord_ID, Ord_Date, Ord_Price, Ord_Qty, Emp_ID)
VALUES ('O001', '1 JAN 2010', 'RM 9374.00', 6000, 'E001');
Sep 17 '10 #1
9 12593
OraMaster
135 100+
Here you have to make sure whatever value for column ORDER_PHARMACY.Emp_ID you are inserting should exists in a table EMPLOYEE since you are referring to this tables Emp_ID. Hope this will help.
Sep 17 '10 #2
amitpatel66
2,367 Expert 2GB
Does the employee id E001 exist in the employee table? If not then you will get integrity constraint error
Sep 20 '10 #3
it means that i have to insert the value of employee's table first before insert the value of order right?ok.i can understand now.thank you so much to help to solve this problem.
Sep 21 '10 #4
amitpatel66
2,367 Expert 2GB
Yes thats right. Thats what Integrity Constraints make sure that for every child record, there is parent recrod available.

So in your case, EMPLOYEE Table is Parent Table with primary Key and ORDER_PHARMACY is Child table with foreign key.
Sep 21 '10 #5
Can i ask you about how to integrate between 4 database(oracle,sql server,mysql and progres sql)?and what is coding to make all those data to be connect?
Sep 21 '10 #6
debasisdas
8,127 Expert 4TB
How much you are ready to pay for all the coding ?
Sep 22 '10 #7
amitpatel66
2,367 Expert 2GB
You can try using SQLDEVELOPER -> Migration option and check how it helps migrating data between different databases.

And, what you mean by integrating different databases? You mean transferring all the objects from different databases in to oracle or vice versa?
Sep 23 '10 #8
What i mean is table in my database that is oracle can retrieve the data of other database like table in sql,my sql and prosgres
Sep 24 '10 #9
amitpatel66
2,367 Expert 2GB
Yes. You can export the data from other databases in to a flat file and load the data from flat file in to oracle or any other database as required.
Sep 27 '10 #10

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by Jochen Daum | last post: by
16 posts views Thread by ommadawn | last post: by
5 posts views Thread by Greg Vereschagin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.