Start of change

SQL_ERROR_LOG view

The SQL_ERROR_LOG view returns information captured by the SQL Error Logging Facility (SELF).

Authorization: The caller must have *ALLOBJ special authority or be authorized to the QIBM_DB_SQLADM function usage identifier.

The following table describes the columns in the view. The system name is SQL_ERROR. The schema is QSYS2.

Table 1. SQL_ERROR_LOG view
Column Name System Column Name Data Type Description
LOGGED_SQLCODE LOG_CODE INTEGER The SQLCODE for this instance of SELF detail.
LOGGED_SQLSTATE LOG_STATE CHAR(5) The SQLSTATE that corresponds to LOGGED_SQLCODE.
NUMBER_OCCURRENCES MATCHES BIGINT Number of times this LOGGED_SQLCODE has occurred for this STATEMENT_TEXT from the program or service program identified by PROGRAM_LIBRARY, PROGRAM_NAME, and MODULE_NAME.
STATEMENT_TEXT STMTTEXT DBCLOB(2M) CCSID 1200 The SQL statement that encountered the SQLSTATE that corresponds to LOGGED_SQLCODE. Can contain the special value of UNKNOWN if the statement text is not available.
STATEMENT_OPERATION OP_CODE CHAR(2) The SQL statement operation. For a list of values, see the QQC21 field in Database monitor view 1000 - SQL Information.
STATEMENT_OPERATION_DETAIL OP_DETAIL VARCHAR(50) Descriptive text that corresponds to STATEMENT_OPERATION.
REASON_CODE SQLCODE_RC
INTEGER
Nullable
The reason code returned for LOGGED_SQLCODE.

Contains the null value if LOGGED_SQLCODE has no reason code.

PROGRAM_LIBRARY PGM_LIB VARCHAR(10) Library containing PROGRAM_NAME. Can contain the special value of UNKNOWN if the program library is not available.
PROGRAM_NAME PGM_NAME VARCHAR(10) Program or service program name that encountered LOGGED_SQLCODE. Can contain the special value of UNKNOWN if the program name is not available.
PROGRAM_TYPE PGM_TYPE VARCHAR(7) Object type of PROGRAM_NAME.
*PGM
This is a program
*SRVPGM
This is a service program
*SQLPKG
This is an SQL package
Can contain the special value of UNKNOWN if the program type is not available.
MODULE_NAME MOD_NAME
VARCHAR(10)
Nullable
Module name if PROGRAM_NAME is an ILE program or service program.

Contains the null value if PROGRAM_NAME is not an ILE program or service program.

LOGGED_TIME LOG_TIME TIMESTAMP Timestamp of the most recent occurrence of LOGGED_SQLCODE.
JOB_NAME JOB_NAME VARCHAR(28) The qualified job name of the most recent occurrence of LOGGED_SQLCODE.
Start of changeTHREAD_IDEnd of change Start of changeTHREAD_IDEnd of change Start of changeBIGINTEnd of change Start of changeThe thread identifier of the most recent occurrence of LOGGED_SQLCODE. A thread ID of 0 indicates that the thread ID is not available.End of change
ADOPTED_USER_NAME ADOPT_USER VARCHAR(10) Value of the CURRENT_USER special register for the most recent occurrence of LOGGED_SQLCODE.
USER_NAME USER_NAME VARCHAR(10) Value of the USER special register for the most recent occurrence of LOGGED_SQLCODE.
SYSTEM_USER_NAME SYS_USER VARCHAR(10) Value of the SYSTEM_USER special register for the most recent occurrence of LOGGED_SQLCODE.
CLIENT_ACCTNG ACCTNG
VARCHAR(255)
Nullable
Value of the CURRENT CLIENT_ACCTNG special register for the most recent occurrence of LOGGED_SQLCODE.
Contains the null value if the special register has no value.
CLIENT_APPLNAME APPLNAME
VARCHAR(255)
Nullable
Value of the CURRENT CLIENT_APPLNAME special register for the most recent occurrence of LOGGED_SQLCODE.
Contains the null value if the special register has no value.
CLIENT_PROGRAMID PROGRAMID
VARCHAR(255)
Nullable
Value of the CURRENT CLIENT_PROGRAMID special register for the most recent occurrence of LOGGED_SQLCODE.
Contains the null value if the special register has no value.
CLIENT_USERID USERID
VARCHAR(255)
Nullable
Value of the CURRENT CLIENT_USERID special register for the most recent occurrence of LOGGED_SQLCODE.
Contains the null value if the special register has no value.
CLIENT_WRKSTNNAME WRKSTNNAME
VARCHAR(255)
Nullable
Value of the CURRENT CLIENT_WRKSTNNAME special register for the most recent occurrence of LOGGED_SQLCODE.
Contains the null value if the special register has no value.
RDB_NAME RDB_NAME VARCHAR(18) Value of the CURRENT_SERVER special register for the most recent occurrence of LOGGED_SQLCODE.
INITIAL_LOGGED_TIME INIT_TIME TIMESTAMP Timestamp of the initial occurrence of LOGGED_SQLCODE.
INITIAL_JOB_NAME INIT_JOB VARCHAR(28) Qualified job name of the initial occurrence of LOGGED_SQLCODE.
Start of changeINITIAL_THREAD_IDEnd of change Start of changeINIT_THDEnd of change Start of changeBIGINTEnd of change Start of changeThe thread identifier of the initial occurrence of LOGGED_SQLCODE. A thread ID of 0 indicates that the thread ID is not available.End of change
INITIAL_ADOPTED_USER_NAME INIT_ADOPT VARCHAR(10) Value of the CURRENT_USER special register for the most recent occurrence of LOGGED_SQLCODE.
INITIAL_STACK INIT_STACK
CLOB(1M) CCSID 1208
The call stack of the current thread for the initial occurrence of LOGGED_SQLCODE.
End of change