If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > triggerUpdate

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-14-04, 06:33
lullo lullo is offline
Registered User
 
Join Date: Nov 2003
Posts: 20
triggerUpdate

hello people,
few days ago I had a problem with a insert trigger for this table:
CODICE DESCRIZION TIPO.

now I would like to create a update trigger, that update/insert the record in ADMIN.ANAMAGA_TMP after an update in my table ADMIN.ANAMAGA
but the problem is that at the begining my column TIPO is empty. I try 4 way:
1)
CREATE TRIGGER ADMIN.REPLICA5 AFTER UPDATE OF CODICE, DESCRIZION, TIPO ON ADMIN.ANAMAGA REFERENCING NEW AS n FOR EACH ROW MODE DB2SQL UPDATE
ADMIN.ANAMAGA_TMP
SET DESCRIZION = n.descrizion,
TIPO = n.TIPO
WHERE
(
( ADMIN.ANAMAGA_TMP.CODICE = n.codice )
AND ( ADMIN.ANAMAGA_TMP.DESCRIZION <> n.descrizion OR ADMIN.ANAMAGA_TMP.TIPO is null )
)//nothing
2)
CREATE TRIGGER ADMIN.REPLICA1 AFTER UPDATE OF CODICE, DESCRIZION, TIPO ON ADMIN.ANAMAGA REFERENCING NEW AS n FOR EACH ROW MODE DB2SQL INSERT INTO
ADMIN.ANAMAGA_TMP
VALUES
(
n.CODICE,
n.DESCRIZION,
n.TIPO
) ////update CODICE, DESCRIZION, but not TIPO

||||||||||||||||more simple

CREATE TRIGGER ADMIN.REPLICA1 AFTER UPDATE OF TIPO ON ADMIN.ANAMAGA REFERENCING NEW AS n FOR EACH ROW MODE DB2SQL INSERT INTO
ADMIN.ANAMAGA_TMP
VALUES
(
n.TIPO
)/////all rows empty

at the end

CREATE TRIGGER ADMIN.REPLICA1 AFTER UPDATE OF TIPO ON ADMIN.ANAMAGA REFERENCING NEW AS n FOR EACH ROW MODE DB2SQL INSERT INTO
ADMIN.ANAMAGA_TMP
(TIPO)
VALUES
(
n.TIPO
)/////nothng


can you help me? thanks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

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

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