Subject | Re: preventing orphaned rows |
---|---|
Author | dtrudgett |
Post date | 2002-02-17T02:28:15Z |
Duilio Foschi wrote:
trigger on the master table? Alternatively, insert both the master row
and the first detail row using a stored procedure that first does the
master, then the detail.
Similarly, you could use a BEFORE DELETE trigger on the detail table
to make sure at least one detail row remains for the master row.
Come va il progetto?
David Trudgett
> I have a master table and a detail table.Have you thought of inserting a detail row from within an AFTER INSERT
>
> I want to prevent (at the DB level)
>
> 1. that a master record is inserted with no detail record
> 2. that a detail record is inserted with no master record
trigger on the master table? Alternatively, insert both the master row
and the first detail row using a stored procedure that first does the
master, then the detail.
Similarly, you could use a BEFORE DELETE trigger on the detail table
to make sure at least one detail row remains for the master row.
Come va il progetto?
David Trudgett