Subject | preventing orphaned rows |
---|---|
Author | Duilio Foschi |
Post date | 2002-02-16T17:50:36Z |
I have a master table and a detail table.
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
Point 2. is easy: I already created a foreign key in the detail table and
it does the job
Point 1. puzzles me: I need to insert the master record first, (because of
point 2.) and at that time I cannot know how many detail records will be
inserted...
In one of the book I read re SQL, there is an explanation of _assertions_ .
They seem to be the beasts I need, but they are not reported in LangRef, so
I assume that FB doesn't offer them.
Is there any solution to the problem ?
TYIA
Duilio Foschi
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
Point 2. is easy: I already created a foreign key in the detail table and
it does the job
Point 1. puzzles me: I need to insert the master record first, (because of
point 2.) and at that time I cannot know how many detail records will be
inserted...
In one of the book I read re SQL, there is an explanation of _assertions_ .
They seem to be the beasts I need, but they are not reported in LangRef, so
I assume that FB doesn't offer them.
Is there any solution to the problem ?
TYIA
Duilio Foschi