We need to retrieve the code that defines a trigger. Not just the code of the trigger(systriggers.action_statement) but the full create statement.
I think we have all the elements except for the list of columns in the UPDATE OF clause.
This information can be retrieved as follows:
SELECT TRIGGERED_UPDATE_COLUMNS FROM QSYS2.SYSTRIGUPD where EVENT_OBJECT_SCHEMA
= '%s' and EVENT_OBJECT_TABLE='%s' and TRIGGER_NAME='%s'
What we need to do is create a function accepting 3 parameters Table Library, Table Name, Trigger Name and will return a comma delimited list of the triggered update columns based on the query above. If the query returns no rows, the function should return ''. The function will be called within the SQL statement retrieving the Triggers.
Can anyone assist me in writing this function?
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!