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: update database trigger

RE: update database trigger

From: Ganesh Raja <ganesh_at_gtfs-gulf.com>
Date: Wed, 12 Dec 2001 00:43:59 -0800
Message-ID: <F001.003DA946.20011212003020@fatcity.com>

The Where Clause Gives the rows...

create or replace trigger trg_on_T1
before update on T1
for each row
begin
if updating then
update T2

set     a=:new.a,
        b=:new.b,
        c=:new.c

Where a=:old.a and b=:old.b and c=:old.c;

end if;
end trg_on_T1;

HTH Best Regards,
Ganesh R
Tel : +971 (4) 397 3337 Ext 420
Fax : +971 (4) 397 6262
HP : +971 (50) 7456019

-----Original Message-----
[mailto:Shrinivas.Tatireddy_at_med.ge.com]
Sent: Wednesday, December 12, 2001 12:05 PM To: Multiple recipients of list ORACLE-L

Hi lists,

DB:Oracle 8i

I need to write a db trigger on table T1. It has to update T2 when ever T1 is updated.
(Both T1 and T2 tables have identical structure.)

The following query is doing wrong update.

can anybody tell me what is wrong in this code:

create or replace trigger trg_on_T1
before update on T1
for each row
begin
if updating then
update T2

set     a=:new.a,
        b=:new.b,
        c=:new.c;
                        -- how to add the where clause..?
end if;
end trg_on_T1;

I dont know how to use where clause in this. b'coz all columns can be updated by users.

Can anybody give any hints.

Thnx in advance

Srinivas
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Tatireddy, Shrinivas (MED, Keane)   INET: Shrinivas.Tatireddy_at_med.ge.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).
--

Please see the official ORACLE-L FAQ: http://www.orafaq.com
--

Author: Ganesh Raja
  INET: ganesh_at_gtfs-gulf.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 Wed Dec 12 2001 - 02:43:59 CST

Original text of this message

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