Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2009

    Unanswered: ora-02291 integrity constraint

    I am working on a project that handles customer orders and inventory. I am stuck on one part, I keep getting the ORA-02291 error. The column causing the problems is the CustOrderID. Here's what I have:

    This statement uses a sequence to create a new CustOrderID
    select CustOrder_seq.nextval into l_CustOrderID from dual;
    This statement inserts the new CustOrderID into the header:
    insert into CustOrder (CustOrderID, OrderDate, CustID, DateComplete, OrderTotal)
                    values(l_CustOrderID, sysdate, l_CustID, NULL, NULL);
    This last statement inserts the new CustOrderID into the OrderLine table:
      insert into OrderLine 
          (OrderLineID, CustOrderID, SKU, LineQty, UnitPrice)
          values (NULL, l_CustOrderID, x.c001, x.c004, x.c003);
    What I don't understand is if I have created the new CustOrderID using the sequence and then doing the inserts, why do I continue to get this error?


  2. #2
    Join Date
    Aug 2003
    Where the Surf Meets the Turf @Del Mar, CA
    Provided Answers: 1
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts