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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Trigger Question

Re: Trigger Question

From: Stephane Faroult <sfaroult_at_oriole.com>
Date: Mon, 21 Jan 2002 12:23:14 -0800
Message-ID: <F001.003F6449.20020121120519@fatcity.com>

Hamid Alavi wrote:
>
> List,
>
> I have some problem with Trigger, I want to Insert a record as Primary Key
> on each insert into Table1 and the same time create another Primary key in
> table2 plus PK from Tabl1 inserting in Table2 as Forign Key, Is there any
> way to do all these steps in one trigger and assign this trigger to table1
> or some thing like this or not?
> THanks Alot
>
> Hamid Alavi
> Office 818 737-0526
> Cell 818 402-1987
>

Convoluted logic. Use a sequence as the key for table1 and refer to seq.currval inside the trigger to insert the FK into table2. Do not try to do in triggers what Oracle does perfectly well as a standard feature.

-- 
Regards,

Stephane Faroult
Oriole Ltd
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Stephane Faroult
  INET: sfaroult_at_oriole.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Mon Jan 21 2002 - 14:23:14 CST

Original text of this message

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