Subject | Re: [firebird-support] How to save a parent-child relation? |
---|---|
Author | W O |
Post date | 2011-08-20T19:02:15Z |
Yes, because a parent without a child has not sense in my application.
So, I want to avoid that possibility.
Greetings.
Walter.
So, I want to avoid that possibility.
Greetings.
Walter.
On Sat, Aug 20, 2011 at 10:29 AM, Ann Harrison <aharrison@...>wrote:
> **
>
>
>
> On Aug 20, 2011, at 6:25 AM, W O <sistemas2000profesional@...>
> wrote:
>
> > Hello everybody
> >
> > I have two tables in a parent-child relation.
> >
> > How can I avoid to save a row in the parent table if there is not a row
> in
> > the child table?
> >
> > If the parent table has a row and the child table has one (or several)
> rows,
> > it is ok.
> >
> > If the parent table has a row and the child table has not one (or
> several)
> > rows, reject.
>
> OK, let me try to restate that. The foeeign key constraint requires that
> each child have qa parent. You also want to require that each parent have at
> least one child. The obvious question is how do you ever store a new parent,
> in the absence of deferred constraints. You could use triggers.
>
> Good luck,
>
> Ann
>
>
>
[Non-text portions of this message have been removed]