Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: "ON DELETE CASCADE" references more than one table

Re: "ON DELETE CASCADE" references more than one table

From: Dmitri Ivanov <di24va56nov_at_aha.ru-Digits-for-spammers>
Date: Mon, 3 Mar 2003 12:27:08 +0300
Message-ID: <b3v92k$1ber$1@news.aha.ru>


Hello Wei,
"Wei Jiang" <_weijiang__at_yahoo.com> wrote:

WJ> Hi All,
WJ>
WJ> I have a table
WJ>
WJ> CREATE TABLE address (..., ownerId int, ...)
WJ>
WJ> I alse have many other tables, such as employee, contractor,
WJ> vender.... All of these table can own an address.
WJ>
WJ> What is the best way to delete an address if I delete an employee
WJ> or contractor?
WJ>
WJ> I can not use
WJ>
WJ> FOREIGN KEY (customerId) REFERENCES customer (id)
WJ>
WJ> on address, because I can only reference customer, not employee or
WJ> contractor.

I am afraid you must introduce separate CustomerId, EmploeeId, and ConractorId columns in the address table in order to achieve that.

--
Sincerely,
Dmitri Ivanov
www.aha.ru/~divanov
Received on Mon Mar 03 2003 - 03:27:08 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US