dbTalk Databases Forums  

Trigger insert on parent table question

comp.databases.oracle comp.databases.oracle


Discuss Trigger insert on parent table question in the comp.databases.oracle forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Sean
 
Posts: n/a

Default Trigger insert on parent table question - 02-04-2005 , 09:44 AM






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

Reply With Quote
  #2  
Old   
DA Morgan
 
Posts: n/a

Default Re: Trigger insert on parent table question - 02-04-2005 , 01:30 PM






Sean wrote:

Quote:
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
Anything can be done. But two questions:
1. Why are you deciding how you want to do something rather than
stating a business case?

2. Why didn't you just try it?

Personally I think you are creating great complexity where simplicity
would suffice.
--
Daniel A. Morgan
University of Washington
damorgan@x.washington.edu
(replace 'x' with 'u' to respond)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.