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 Triggers

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-23-03, 15:11
Rick-dba Rick-dba is offline
Registered User
 
Join Date: Apr 2003
Location: Florida
Posts: 79
Question DB2 Triggers

OS/390 DB2 v6.1
Anyone know how to create a before trigger that will set my partition number - such as:

CREATE TRIGGER FSDBA.FSSTULOG NO CASCADE
BEFORE INSERT ON FSDBA.WWW_STUDENT_LOG
REFERENCING NEW AS NEW_ROW
FOR EACH ROW
MODE DB2SQL
BEGIN ATOMIC
SET NEW_ROW.LOG_PARTITION = SELECT DAYOFWEEK(CURRENT_DATE) FROM SYSIBM.SYSDUMMY1
;
END
;
Reply With Quote
  #2 (permalink)  
Old 12-24-03, 11:06
Rick-dba Rick-dba is offline
Registered User
 
Join Date: Apr 2003
Location: Florida
Posts: 79
Got it working:

SET CURRENT SQLID = 'FSDBA';

--#SET TERMINATOR ~

CREATE TRIGGER FSDBA.FSSTULOG NO CASCADE

BEFORE INSERT ON FSDBA.WWW_STUDENT_LOG REFERENCING NEW AS N

FOR EACH ROW MODE DB2SQL

BEGIN ATOMIC

SET N.LOG_PARTITION = DAYOFWEEK(CURRENT_DATE);

END ~
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