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 > create triggers

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-07-04, 11:01
zarconja zarconja is offline
Registered User
 
Join Date: Dec 2002
Posts: 25
Unhappy create triggers

Please...
somebody could say so that it shows error when I create the following one to trigger in UDB DB2 8.1.4 for Windows :
(I am trying to create it from the control center)

CREATE TRIGGER SQM.TRGU_INTENT AFTER UPDATE OF IN_IDISR, VC_PAN, IN_IDTRANSACTION, IN_INTENT, IN_MAXINTENT ON SQM.T3DS_INTENT
REFERENCING OLD AS ANTES NEW AS NUEVO FOR EACH ROW MODE DB2SQL
DECLARE
IDUSER INTEGER;
IDACTION INTEGER;
IDISRMECHAN INTEGER;
IDMECHANISM INTEGER;

BEGIN ATOMIC
IF (NUEVO.IN_INTENT = NUEVO.IN_MAXINTENT) THEN
SET IDMECHANISM = CASE IN_IDTRANSACTION
WHEN 0 THEN 9
ELSE 7
END;
SET IDUSER = (SELECT IN_IDUSER FROM SQM.T3DS_USER WHERE IN_IDISR=NUEVO.IN_IDISR AND IN_IDROLL=6);
SET IDISRMECHAN = (SELECT IN_IDISRMECHAN FROM SQM.TPP_ISRMECHAN WHERE IN_IDISR = NUEVO.IN_IDISR AND IN_IDMECHANISM = IDMECHANISM);
INSERT INTO SQM.T3DS_LOGINTENT (IN_IDISR, VC_PAN, IN_IDTRANSACTION, IN_INTENT, IN_MAXINTENT, CH_STATE) VALUES (NUEVO.IN_IDISR, NUEVO_VC_PAN, NUEVO.IN_IDTRANSACTION, NUEVO.IN_INTENT, NUEVO.IN_MAXINTENT, '1');
INSERT INTO SQM.T3DS_ACTION (IN_IDACTIONTYPE, IN_IDUSER, IN_IDISR, IN_IDISRMECHAN) VALUES (2,IDUSER,NUEVO.IN_IDISR,IDISRMECHAN);
SET IDACTION = SELECT IDENTITY_VAL_LOCAL() FROM SYSIBM.SYSDUMMY1;
UPDATE SQM.T3DS_ACCOUNT SET IN_IDACTION = IDACTION, IN_ENROLL=4 WHERE VC_PAN = NUEVO.VC_PAN;
ELSE
INSERT INTO SQM.T3DS_LOGINTENT (IN_IDISR, VC_PAN, IN_IDTRANSACTION, IN_INTENT, IN_MAXINTENT, CH_STATE) VALUES (NUEVO.IN_IDISR, NUEVO_VC_PAN, NUEVO.IN_IDTRANSACTION, NUEVO.IN_INTENT, NUEVO.IN_MAXINTENT, '0');
END IF;
END;

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