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 > DB2 Trigger inserting multiple rows in audit table for update event

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-23-09, 00:00
narasridhar narasridhar is offline
Registered User
 
Join Date: Oct 2008
Posts: 5
DB2 Trigger inserting multiple rows in audit table for update event

Hi,

I have coded my Trigger as below

CREATE TRIGGER TRIG0
AFTER UPDATE ON INSOUDVL.STTN_V01
REFERENCING NEW AS NAUDIT OLD AS OAUDIT
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
WHEN (NAUDIT.STTN_DELETE_MKR = ' ')
INSERT INTO INSOUDVL.STTT_V01
VALUES ('U',
OAUDIT.STTN_1141_CODE ,
OAUDIT.STTN_EASTING ,
OAUDIT.STTN_NORTHING ,
OAUDIT.STTN_LAST_AMENDED ,
OAUDIT.STTN_ISSUED ,
OAUDIT.STTN_FULL_NAME ,
OAUDIT.STTN_CODE_TYPE ,
NAUDIT.STTN_DELETE_MKR ,
OAUDIT.STTN_FIBRE_IND ,
OAUDIT.STTN_CCITT_ID ,
OAUDIT.STTN_NODE_NUM ,
OAUDIT.STTN_DIST_NUM_FK ,
OAUDIT.STTN_DMIM_DIST_FK ,
OAUDIT.STTN_DMIM_REF_FK ,
OAUDIT.STTN_CUST_NAME_FK ,
OAUDIT.STTN_AMENDED_BY ,
OAUDIT.STTN_CD_AMENDED_BY ,
OAUDIT.STTN_CD_AMENDED ,
OAUDIT.STTN_THROUGH_RTG ,
OAUDIT.STTN_EQPT_LOADED ,
OAUDIT.STTN_EQPT_SOURCE ,
OAUDIT.STTN_COS_MAN_IND ,
OAUDIT.STTN_CUST_SITE_ID,
CURRENT TIMESTAMP)
;

When i update the source table through application mu update trigger is writing multiple rows in audit table. Could anyone let me know the reason why it is writing multple records.

Thanks in Advance!!!
Reply With Quote
  #2 (permalink)  
Old 09-23-09, 08:16
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
What DB2 version and OS are you using? What is the UPDATE statement you are using? What are the rows being entered by the trigger?

Andy
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