How to solve ORA-02291: integrity constraint error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dila puteh
    New Member
    • Sep 2010
    • 5

    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');
  • OraMaster
    New Member
    • Aug 2009
    • 135

    #2
    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.

    Comment

    • amitpatel66
      Recognized Expert Top Contributor
      • Mar 2007
      • 2358

      #3
      Does the employee id E001 exist in the employee table? If not then you will get integrity constraint error

      Comment

      • dila puteh
        New Member
        • Sep 2010
        • 5

        #4
        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.

        Comment

        • amitpatel66
          Recognized Expert Top Contributor
          • Mar 2007
          • 2358

          #5
          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.

          Comment

          • dila puteh
            New Member
            • Sep 2010
            • 5

            #6
            data integration

            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?

            Comment

            • debasisdas
              Recognized Expert Expert
              • Dec 2006
              • 8119

              #7
              How much you are ready to pay for all the coding ?

              Comment

              • amitpatel66
                Recognized Expert Top Contributor
                • Mar 2007
                • 2358

                #8
                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?

                Comment

                • dila puteh
                  New Member
                  • Sep 2010
                  • 5

                  #9
                  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

                  Comment

                  • amitpatel66
                    Recognized Expert Top Contributor
                    • Mar 2007
                    • 2358

                    #10
                    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.

                    Comment

                    Working...