| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: Foreign key pointing to multiple tables
Yep, we need a priamry key in each of the job tables to prevent
duplicates.
CREATE TABLE A_jobs
(job_ticket INTEGER NOT NULL PRIMARY KEY
REFERENCES Tickets(job_ticket),
job_type CHAR(1) DEFAULT 'A' NOT NULL
CHECK(job_type = 'A'),
FOREIGN KEY(job_ticket, job_type)
REFERENCES Tickets (job_ticket, job_type)
ON DELETE CASCADE
ON UPDATE CASCADE,
...);
But I do need the FOREIGN KEY (job_ticket, job_type) to make that the job_ticket bellongs to one and only one job_type. Received on Mon Sep 22 2003 - 14:30:05 CDT
![]() |
![]() |