Home » SQL & PL/SQL » SQL & PL/SQL » Integrity constraint violation (19.2)
Integrity constraint violation [message #686245] Wed, 13 July 2022 00:46 Go to next message
Unclefool
Messages: 82
Registered: August 2021
Member
When I'm INSERTING a payment record I'm getting the following error.

ORA-02291: integrity constraint

Why is this happening and how can I fix it?


CREATE TABLE CUSTOMER
(
Customer_ID varchar(255) NOT NULL,
Customer_Name varchar(50),
Customer_Gender varchar(10),
Customer_DOB DATE ,
CONSTRAINT CUSTOMER_PK PRIMARY KEY(Customer_ID)
) ;

CREATE TABLE PAYMENT
(
Payment_ID varchar(255) NOT NULL,
Customer_ID varchar(255),
Payment_Method varchar(30),
Payment_Date varchar(20),
Payment_Total NUMBER(10,2) ,
CONSTRAINT PAYMENT_PK PRIMARY KEY(Payment_ID),
CONSTRAINT fk_customer FOREIGN KEY(Customer_ID) REFERENCES CUSTOMER(Customer_ID)
) ;


INSERT INTO CUSTOMER VALUES ('1277','Jenny','Female',    ( TO_Date ( '03/04/1988' , 'DD/MM/yyyy')))


INSERT INTO PAYMENT VALUES ('1277', '24P','Cash',            ( TO_Date ( '11/02/2022' , 'DD/MM/YYYY')),24.50);

Re: Integrity constraint violation [message #686246 is a reply to message #686245] Wed, 13 July 2022 00:55 Go to previous messageGo to next message
John Watson
Messages: 8922
Registered: January 2010
Location: Global Village
Senior Member
You have no customer with customer_id 24P.
Re: Integrity constraint violation [message #686247 is a reply to message #686246] Wed, 13 July 2022 01:14 Go to previous message
Unclefool
Messages: 82
Registered: August 2021
Member
Thanks
Previous Topic: Sporadic Certification Validation Error While accessing the external portal
Next Topic: Plsql using NVL
Goto Forum:
  


Current Time: Fri Mar 29 08:09:46 CDT 2024