Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 11:20 PM
Sean
Guest
 
Posts: n/a
Default Trigger insert on parent table question

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
  #2  
Old July 19th, 2005, 11:20 PM
DA Morgan
Guest
 
Posts: n/a
Default Re: Trigger insert on parent table question

Sean wrote:
[color=blue]
> 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[/color]

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)
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

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

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles