Personalised SQL error logging, SELF Simon Hutchinson

​Introduced as part of IBM i 7.5 Technology Refresh 1 and IBM i 7.4 TR7, is a mechanism to capture details of SQL errors into a separate log table. I can decide which errors I want to capture in the log, by use of the SQL code. The SQL codes to capture are set at the SQL session level, rather than at the IBM i job level.
This is called the SQL Error Logging Facility, or SELF for short. It consists of several parts, the parts I am going to explain in detail are:

SQL_ERROR_LOG:  A View that is used to display the logged errors
SELFCODES:  A Global Variable that needs to contain the SQL codes I wish to log
VALIDATE_SELF:  A scalar function that validates SQL codes

Read more » Read More 

Verified by MonsterInsights