Quick Search:
 
 Oracle PL/SQL: Foreign Key Constraints Jump to:  
Category: >> Oracle PL/SQL >> Foreign Key Constraints  

<< lastnext >>

Snippet Name: Foreign Key Constraints

Description: The sole purpose of a foreign key constraint is to define a relationship between two tables.

This foreign key column establishes a direct relationship with a primary key or unique key column (referenced key) usually in another table.

The table containing the foreign key is referred to as the child, and the table containing the referenced key is the parent table.

The foreign key and referenced key can be in the same table (parent and child are the same table); otherwise, the parent and child tables must be in the same database.

Also see:
» Check Constraint: Create
» Unique Constraint
» Primary Key Constraint
» Current_timestamp
» Deferring Constraint Checking
» Add Primary Key Constraint example
» Constraint Checks
» Add constraint example

Comment: (none)

Language: PL/SQL
Highlight Mode: PLSQL
Last Modified: March 07th, 2009

ALTER TABLE RB_ACCOUNTS DROP CONSTRAINT RACCO_FK1; 
ALTER TABLE RB_ACCOUNTS DROP CONSTRAINT RACCO_FK3; 
ALTER TABLE RB_ACCOUNTS DROP CONSTRAINT RACCO_FK7; 
ALTER TABLE RB_ACCOUNT_CHARGES DROP CONSTRAINT RACH_FK1; 
ALTER TABLE RB_TAPE_FORMAT_BANDS DROP CONSTRAINT RTFB_FK1; 
 
ALTER TABLE RB_ACCOUNTS
     ADD CONSTRAINT racco_fk1 FOREIGN KEY (CUSTOMER_ID) 
     REFERENCES RB_CUSTOMERS (CUSTOMER_ID);
 
ALTER TABLE RB_ACCOUNTS
     ADD CONSTRAINT racco_fk3 FOREIGN KEY (BILLING_CYCLE_ID) 
     REFERENCES RB_BILLING_CYCLES (BILLING_CYCLE_ID);
 
ALTER TABLE RB_ACCOUNTS
     ADD CONSTRAINT racco_fk4 FOREIGN KEY (CSR_PEOPLE_ID) 
     REFERENCES RB_PEOPLE (PEOPLE_ID);
 
ALTER TABLE RB_TAPE_FORMAT_BANDS
     ADD CONSTRAINT rtfb_fk1 FOREIGN KEY (FORMAT_ID)
     REFERENCES RB_TAPE_FORMATS (FORMAT_ID);


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org