By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,611 Members | 1,642 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,611 IT Pros & Developers. It's quick & easy.

Multiple condition trigger

P: 1
I need help with a multiple condition trigger. I saw a post on Dec '06 and coded my trigger like that one but it still doesn't work. I am using DB2 V9 on z/OS.

CREATE TRIGGER DB2DBA.DSOPTCR5
NO CASCADE BEFORE INSERT ON MAD.DSOPTCT
REFERENCING NEW AS N
FOR EACH ROW MODE DB2SQL
SELECT CASE WHEN N.CNSTRNT_TO_TYPE_CD = 'C'
AND NOT EXISTS(SELECT 1
FROM MAD.DSCNCUT
WHERE MAD.DSCNCUT.CUST_GUID = N.TO_GUID)
THEN CAST(RAISE_ERROR(
'MI001',
'CUSTOMER IS NOT ON FILE')) AS INT
WHEN N.CNSTRNT_TO_TYPE_CD = 'H'
AND NOT EXISTS(SELECT 1
FROM MAD.DSCNHAT
WHERE MAD.DSCNHAT.CUST_GUID = N.TO_GUID)
RAISE_ERROR(
'MI001',
'HAULER IS NOT ON FILE');
WHEN N.CNSTRNT_TO_TYPE_CD = 'L'
AND NOT EXISTS(SELECT 1
FROM MAD.DSCNLDT
WHERE MAD.DSCNLDT.CUST_GUID = N.TO_GUID)
RAISE_ERROR(
'MI001',
'THE LOAD IS NOT ON FILE');
END
FROM SYSIBM.SYSDUMMY1;

Thank you for your help.
Feb 1 '10 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.