IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

CREATE TRIGGER INSTEAD OF failure


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vladimir Mestovski

New User


Joined: 15 Nov 2011
Posts: 4
Location: Belarus

PostPosted: Mon Jul 02, 2012 6:07 pm
Reply with quote

Hi DB2 experts,
can you help me to understand the reason of the following failure, does the DB2 V9.1 support the INSTEAD OF in the CREATE TRIGGER?

CONNECT;
*** CONNECT successful, SERVER_NAME='BYDB2LABE', PRODUCT_ID='DSN09010'
*** SERVER_CLASS='QDB2 for DB2 UDB for z/OS'

--CREATE VIEW V2IBAVM.WIPINVRUL5
-- (RULE_TYPE,ACTIVE_IND,PN,RECV_LOC)
-- AS SELECT RULE_TYPE,ACTIVE_IND,PN,CHAR(SUBSTR(FAMILY,1,4),4)
-- FROM V2IBAVM.TOM_RULES
-- WHERE RULE_TYPE = 'WIPINVRULE';
--COMMIT;

CREATE TRIGGER WIP_INSERT INSTEAD OF INSERT ON V2IBAVM.WIPINVRUL5
REFERENCING NEW AS NEWWIP FOR EACH ROW MODE DB2SQL
INSERT INTO V2IBAVM.TOM_RULES
(RULE_TYPE,ACTIVE_IND,PN,FAMILY)
VALUES(NEWWIP.RULE_TYPE,NEWWIP.ACTIVE_IND,
NEWWIP.PN,NEWWIP.RECV_LOC);

*DB2error(s) on PREPARE STMNT2:
*DB2error#1* SQLCODE = -4700
*DB2error#1* ATTEMPT TO USE NEW FUNCTION BEFORE NEW FUNCTION MODE
*DB2error#1* SQLSTATE = 56038

56038 │ The requested feature is not supported in this environment. │ -4700, │
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Jul 02, 2012 6:36 pm
Reply with quote

Quote:
ATTEMPT TO USE NEW FUNCTION BEFORE NEW FUNCTION MODE

the message is clear...
read the DB2 manuals about <compatibility> and <new function> mode
and also speak to Your support.
Back to top
View user's profile Send private message
Mahi_e

New User


Joined: 10 Dec 2010
Posts: 43
Location: hyderabad

PostPosted: Tue Jul 03, 2012 12:31 pm
Reply with quote

Vladimir Mestovski wrote:

does the DB2 V9.1 support the INSTEAD OF in the CREATE TRIGGER?


Yes DB2 V9 supports INSTEAD OF TRIGGER......

CREATE VIEW EMP_DEPT (EMPNO, FIRSTNME, MIDINIT, LASTNAME,
PHONENO, HIREDATE, DEPTNAME)
AS SELECT EMPNO, FIRSTNME, MIDINIT, LASTNAME, PHONENO,
HIREDATE, DEPTNAME
FROM EMP, DEPT
WHERE EMP.WORKDEPT = DEPT.DEPTNO;

CREATE TRIGGER E_D_ISRT
INSTEAD OF INSERT ON EMP_DEPT
REFERENCING NEW AS NEWEMP
FOR EACH ROW INSERT INTO EMPLOYEE
(EMPNO, FIRSTNME, MIDINIT, LASTNAME, WORKDEPT, PHONENO, HIREDATE)
VALUES
(EMPNO, FIRSTNME, MIDINIT, LASTNAME,
COALESCE
((SELECT DEPTNO FROM DEPT AS D WHERE D.DEPTNAME = NEWEMP.DEPTNAME),
RAISE_ERROR('70001', 'Unknown dept name')
),
PHONENO, HIREDATE);

Hope this would work fine..........
Correct me if i were wrong.....
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Tue Jul 03, 2012 12:59 pm
Reply with quote

I agree with Enrico that the system you tried it on is not running DB2 9 with NFM. With DB2 9, it's called "conversion mode" though, no?
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts How to create a list of SAR jobs with... CA Products 3
No new posts create rexx edit Macro that edits the... CLIST & REXX 3
No new posts COBOL - create and write to output fi... COBOL Programming 0
No new posts Best way to create an automated line ... TSO/ISPF 3
No new posts how to solve this power failure shutd... ABENDS & Debugging 5
Search our Forums:

Back to Top