Yes, because a parent without a child has not sense in my application. So, I want to avoid that possibility.
Greetings. Walter. On Sat, Aug 20, 2011 at 10:29 AM, Ann Harrison <[email protected]>wrote: > ** > > > > On Aug 20, 2011, at 6:25 AM, W O <[email protected]> > 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] ------------------------------------ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: [email protected] [email protected] <*> To unsubscribe from this group, send an email to: [email protected] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
