Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: "ON DELETE CASCADE" references more than one table
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/~divanovReceived on Mon Mar 03 2003 - 03:27:08 CST