Hi,
I could not figure out why I am getting the following error when I initiated the Insert into the mainframe DB2 table from a server. I have created the trigger and the stored procedure (as shown below). If I insert a row into the table using batch sql job on mainframe, the stored procedure is triggered by the db2 trigger successfully after a row is inserted into the table. However, if I do the same insert through front-end apps using a dynamic sql, I am getting the following error. Could anyone please help?
723: SQL0723N An error occurred in a triggered SQL statement in trigger "MM.MMNSPTRG". Information returned for the error includes SQLCODE "38503", SQLSTATE "PROCEDURE,MM.MM618SP,MM.MM618SP" and message tokens "2". SQLSTATE=09000
901: SQL0901N The SQL statement failed because of a non-severe system error. Subsequent SQL statements can be processed. (Reason "".) SQLSTATE=58004
Below is the Create Trigger:
--DROP TRIGGER MM.MMNSPTRG;
--COMMIT;
--#SET TERMINATOR ?
SET CURRENT SQLID='TAS319'?
SET CURRENT PATH = "SYSIBM","SYSFUN","SYSPROC","TAS319" ?
CREATE TRIGGER MM.MMNSPTRG
AFTER INSERT ON MM.MM_NSPT_TRN
REFERENCING NEW AS N
FOR EACH ROW MODE DB2SQL
BEGIN ATOMIC
CALL MM.MM618SP();
END ?
--#SET TERMINATOR ;
Below is the Create Procedure:
DROP PROCEDURE MM.MM618SP;
COMMIT;
CREATE PROCEDURE MM.MM618SP()
EXTERNAL NAME 'MM618SP'
LANGUAGE COBOL PARAMETER STYLE GENERAL WITH NULLS
NOT DETERMINISTIC FENCED CALLED ON NULL INPUT MODIFIES SQL DATA
NO DBINFO COLLID MM618PCK WLM ENVIRONMENT DSNAPP01
ASUTIME NO LIMIT STAY RESIDENT YES PROGRAM TYPE SUB
SECURITY DB2 INHERIT SPECIAL REGISTERS
CONTINUE AFTER FAILURE COMMIT ON RETURN YES ;
COMMIT;
GRANT ALL
ON PROCEDURE MM.MM618SP TO G115;
COMMIT;
Could anyone please throw some light on the above Issue?
Thanks,
cng