Hello
I am trying to Populate a FK Column( which is a Junction Table) with Values from a PK Column
Desired Result: To Populate the Junction Table Customer_ID FK with the values of the PK Column in Customer_3 Table
Parent Table
Create Table Customer_3 (
Customer_ID Number(10) Default 0,
Constraint Customer_3_Customer_ID_PK Primary Key (Customer_ID)
---------------------------------------------------------------------------------------------------------
Child Table
Create Table Customer_Accounts_3 (
Customer_ID Number(7) Default 0 Not Null,
Account_ID Number(7) Default 0 Not Null,
Constraint Customer_Accts_Cust_ID_FK_3 Foreign Key (Customer_ID)
References Customer_3 (Customer_ID),
Constraint Customer_Accts_Acct_ID_FK_3 Foreign Key (Account_ID)
References Accounts_3 (Account_ID));
----------------------------------------------------------------------------------------------------
Using this Insert Into Select query But getting Error Below
Insert Into Customer_Accounts_3 (Customer_ID)
Select Customer_3.Customer_ID
From Customer_3
Where Customer_3.Customer_ID > 0
ORA-02291: integrity constraint (DS41.CUSTOMER_ACCOUNTS_3_CON) violated - parent key not found
There is a Third Table Accounts that has a FK Account_ID linking back to Customer_Accounts Junction Table Above
I dont think that should matter.
THANK YOU
Thanks in