Get started Bring yourself up to speed with our introductory content.

Calling an RPG LE program from a SQL trigger procedure

Is it possible to call an RPG LE program from SQL trigger procedure? Sample of SQL trigger: Create trigger sampledb01.branch_in...

before insert on sampledb01.branch referencing new row as n for each row mode DB2row call sampledb01.brnch('i', n.branch_no, n.branch_name,n.branch_mgr, n.zone_no,n.region_no,n.status,n.telephone,n.address,n.enablers );

However, I get a message SQL0204 BRNCH in SAMPLEDB01 type *n not found.

The code above lifted from SG24-6503-01 Stored Procedures, Triggers and User Defined Functions.

Absolutely, you can call an RPGLE program from an SQL trigger. However, the RPG program must be registered as an external stored procedure with the CREATE PROCEDURE statement before creating the trigger. There are several examples of external stored procedures in the Redbook that you reference.


Visit the ITKnowledge Exchange and get answers to your DB2 questions fast.

Check out this Search400.com Featured Topic: Expert advice on DB2 

Search400.com's targeted search engine:  Get relevant information on DB2/400. 

The Best Web Links:  Tips, tutorials and more. 

Dig Deeper on iSeries SQL commands and statements