Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Trigger insert on parent table question

Re: Trigger insert on parent table question

From: Rauf Sarwar <rs_arwar_at_hotmail.com>
Date: 4 Feb 2005 08:35:49 -0800
Message-ID: <1107534949.538733.302870@o13g2000cwo.googlegroups.com>


Sean wrote:
> Hey all, I'm new to triggers and I don't know if what I want is
> possible.
>
>
> I have a parent table, dbobjects say. And I have a persons table.
>
> bdobjects.id is a primary key
> persons.id is a primary key and references dbobjecs.id.
>
> Descriptively what I want is:
>
> Before insert on persons
> Insert a row in the dbobjects table *sys_guid() is default for this
> column*
> Iake the value of the new dbojects.id field and assign it to the
> persons.id field of the row about to be inserted
> Continue with persons insert
>
> Can this be done? Oracle 10g BTW.
>
> Thanks so much

You basically want to correct your initial mistake of creating an orphan by somehow creating a parent on the fly. And you want to do this via a trigger on the child table.

Are you just experimenting or is this production code?

And please do not crosspost.

Regards
/Rauf Received on Fri Feb 04 2005 - 10:35:49 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US