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: Ed Stevens <nospam_at_noway.nohow>
Date: Fri, 04 Feb 2005 13:00:06 -0600
Message-ID: <i4h701doe1n7q0vs2m4uac5lv9i1qq266o@4ax.com>


On 4 Feb 2005 07:44:23 -0800, SeanMartinFarrell_at_gmail.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.

Do I understand this correctly? You have a table whose PRIMARY key references another table's PRIMARY key? If I have that correct, you need to go back and review the rules of normalization, then re-work your design. As it stands now, 'objects' is no more the parent of 'persons' than 'persons' is of 'objects'.

>
>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

Thanks.

Cohn's Law: The more time you spend in reporting on what you are doing, the less time you have to do anything. Stability is achieved when you spend all your time doing nothing but reporting on the nothing you are doing. Received on Fri Feb 04 2005 - 13:00:06 CST

Original text of this message

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