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
Code:
select CustOrder_seq.nextval into l_CustOrderID from dual;
This statement inserts the new CustOrderID into the header:
Code:
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:
Code:
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?
Thanks!