SYSPACKSTMT catalog table

The SYSPACKSTMT table contains one or more rows for each SQL statement in a package that is bound locally, and one or more rows for a subset of the SQL statements in a package that is bound remotely. The schema is SYSIBM.

Table 1. SYSIBM.SYSPACKSTMT table column descriptions
Column name Data type Description Use
LOCATION
VARCHAR(128)
NOT NULL
Always contains blanks S
COLLID
VARCHAR(128)
NOT NULL
Name of the package collection. G
NAME
VARCHAR(128)
NOT NULL
Name of the package. G
CONTOKEN
CHAR(8)
NOT NULL
FOR BIT DATA
Consistency token for the package. This is either:
  • The level as specified by the LEVEL option when the package's program was precompiled
  • The timestamp indicating when the package's program was precompiled, in an internal format
S
SEQNO
INTEGER
NOT NULL
Sequence number of the statement.

Rows that contain zero in the SEQNO, STMTNO, and SECTNO column values are for IBM internal use only.

G
STMTNO
SMALLINT
NOT NULL
The statement number of the statement in the source program. If the STMTNO value is zero, the statement number is greater 32767 and the STMTNOI column contains the statement number.

Start of changeA negative value indicates a statement number greater than 32767 in a DRBM created in DB2® version 2.2 or earlier. To convert a negative value to a meaningful statement number, add 65536 to the negative STMTNO value. For example, -26472 is equivalent to +39064 (-26472 + 65536).End of change

Rows that contain zero in the SEQNO, STMTNO, and SECTNO column values are for IBM internal use only.

G
SECTNO
SMALLINT
NOT NULL
The section number of the statement.

For generated packages for SQL routines, such as procedures and user-defined functions, and advanced triggers, a value of 1 indicates the control statement for the routine or advanced trigger. For basic trigger packages, a value of 1 indicates the WHEN clause for activating the trigger.

Rows that contain zero in the SEQNO, STMTNO, and SECTNO column values are for IBM internal use only.

G
BINDERROR
CHAR(1)
NOT NULL
Whether an SQL error was detected at bind time:
N
No
Y
Yes
G
IBMREQD
CHAR(1)
NOT NULL
A value of Y indicates that the row was provided with the Db2 product code. For all other values, see Release dependency indicators.

The value in this field is not a reliable indicator of release dependencies.

G
VERSION
VARCHAR(122)
NOT NULL
Version identifier for the package. G
VARCHAR(3500)
NOT NULL WITH
DEFAULT
FOR BIT DATA
Internal use only. I
ISOLATION
CHAR(1)
NOT NULL WITH
DEFAULT
Isolation level for the SQL statement:
R
RR (repeatable read)
T
RS (read stability)
S
CS (cursor stability)
U
UR (uncommitted read)
L
RS isolation, with a lock-clause
X
RR isolation, with a lock-clause
blank
The WITH clause was not specified on this statement. The isolation level is recorded in SYSPACKAGE.ISOLATION and in SYSPLAN.ISOLATION.
G
STATUS
CHAR(1)
NOT NULL WITH
DEFAULT
Status of binding the statement:
A
Distributed - statement uses Db2 private protocol access. The statement will be parsed and executed at the server using defaults for input variables during access path selection.
B
Distributed - statement uses Db2 private protocol access. The statement will be parsed and executed at the server using values for input variables during access path selection.
C
Compiled - statement was bound successfully using defaults for input variables during access path selection.
D
Distributed - statement references a remote object using a three-part name. Db2 will implicitly use DRDA access either because the DBPROTOCOL bind option was not specified (defaults to DRDA), or the bind option DBPROTOCOL(DRDA) was explicitly specified. This option allows the use of three-part names with DRDA access but it requires that the package be bound at the target remote site.
E
Explain - statement is an SQL EXPLAIN statement. The explain is done at bind time using defaults for input variables during access path selection.
F
Parsed - statement did not bind successfully and VALIDATE(RUN) was used. The statement will be rebound at execution time using values for input variables during access path selection.
G
Compiled - statement bound successfully, but REOPT is specified. The statement will be rebound at execution time using values for input variables during access path selection.
H
Parsed - statement is either a data definition statement or a statement that did not bind successfully and VALIDATE(RUN) was used. The statement will be rebound at execution time using defaults for input variables during access path selection. Data manipulation statements use defaults for input variables during access path selection.
I
Indefinite - statement is dynamic. The statement will be bound at execution time using defaults for input variables during access path selection.
S
STATUS (cont.)  
J
Indefinite - statement is dynamic. The statement will be bound at execution time using values for input variables during access path selection.
K
Control - CALL statement.
L
Bad - the statement has some allowable error. The bind continues but the statement cannot be executed.
M
Parsed - statement references a table that is qualified with SESSION and was not bound because the table reference could be for a declared temporary table that will not be defined until the package or plan is run. The SQL statement will be rebound at execution time using values for input variables during access path selection.
O
Compiled for acceleration. The static query was bound successfully for acceleration and will be routed to an accelerator when executed.
blank
The statement is non-executable, or was bound in a release earlier than DB2 version 5.
 
ACCESSPATH
CHAR(1)
NOT NULL WITH
DEFAULT
For static statements, indicates if the access path for the statement is based on user-specified optimization hints:
H
Optimization hints were used.
A
The access path was reused because of the APREUSE bind option.
blank
One of the following situations:
  • The access path was determined without the use of hints, and a previous access path was not reused.
  • No access path is associated with the statement.
  • The statement is a dynamic SQL statement
G
STMTNOI
INTEGER
NOT NULL WITH
DEFAULT
The statement number of the statement in the source program.

Start of changeA negative value indicates a statement number greater than 32767 in a DRBM created in DB2 version 2.2 or earlier. To convert a negative value to a meaningful statement number, add 65536 to the negative STMTNO value. For example, -26472 is equivalent to +39064 (-26472 + 65536).End of change

G
SECTNOI
INTEGER
NOT NULL WITH
DEFAULT
The section number of the statement.

For generated packages for SQL routines, such as procedures and user-defined functions, and advanced triggers, a value of 1 indicates the control statement for the routine or advanced trigger. For basic trigger packages, a value of 1 indicates the WHEN clause for activating the trigger.

G
EXPLAINABLE
CHAR(1)
NOT NULL WITH
DEFAULT
Contains one of the following values:
Y
Indicates that the SQL statement can be used with the EXPLAIN function and might have rows describing its access path in the owner.PLAN_TABLE.
N
Indicates that the SQL statement does not have any rows describing its access path in the owner.PLAN_TABLE.
blank
Indicates that the SQL statement was bound in a release earlier than DB2 version 7.
G
QUERYNO
INTEGER
NOT NULL WITH
DEFAULT –1
The query number of the SQL statement in the source program. SQL statements bound in releases earlier than DB2 version 7 have a default value of –1. Statements bound in DB2 version 7 or later use the value specified on the QUERYNO clause on SELECT, UPDATE, INSERT, DELETE, EXPLAIN, DECLARE CURSOR, or REFRESH TABLE statements. If the QUERYNO clause is not specified, the query number is set to the statement number. G
ROWID
ROWID
NULL GENERATED
ALWAYS
ROWID column, created for the lob columns in this table. G
STMT_ID
BIGINT
NOT NULL
A unique statement identifier. G
STATEMENT
CLOB(2M)
NOT NULL
WITH DEFAULT
The complete text for the SQL statement that the row represents. G
BLOB(2M)
NOT NULL
WITH DEFAULT
Internal use only. I
EXPANSION_REASON
CHAR(2)
NOT NULL
For dynamic statements, this column is blank. For static statements, one of the following values to indicate the reason that an implicit query transformation occurred when the package was bound:
A
The statement was bound with implicit query transformation as a result of the SYSIBMADM.GET_ARCHIVE built-in global variable.
B
The statement was bound with implicit query transformation as a result of the CURRENT TEMPORAL BUSINESS_TIME special register.
S
The statement was bound with implicit query transformation as a result of the CURRENT TEMPORAL SYSTEM_TIME special register.
SB
The statement was bound with implicit query transformation as a result of the CURRENT TEMPORAL SYSTEM_TIME special register and the CURRENT TEMPORAL BUSINESS_TIME special register.
blank
One of the following occurred:
  • The statement did not bind successfully and the VALIDATE(RUN) bind option was used.
  • The statement was bound without implicit query transformation.
G
QUERYID BIGINT NOT NULL WITH DEFAULT -1 The unique identifier for locating records in the SYSIBM.SYSQUERY catalog table. The -1 default value indicates that no QUERYID value was found for the SQL statement when the package was bound. G
QUERY_HASH CHAR(16) NOT NULL WITH DEFAULT FOR BIT DATA The hash key for locating records in the SYSIBM.SYSQUERY catalog table. Start of changeThis value is not unique for each statement. Other columns for the collection ID, package name, section number, and query number can be used with the hash key for uniqueness.End of change

The '00'x default value indicates that no hash key was generated for the SQL statement when the package was bound.

G
QUERY_HASH_VERSION INTEGER NOT NULL WITH DEFAULT -1 The hash version for locating records in the SYSIBM.SYSQUERY catalog table. The -1 default value indicates that no hash key was generated for the SQL statement when the package was bound. G
COPYID
INTEGER
NULLABLE
Start of change

FL 502 If the DEPLEVEL bind option is STATEMENT, COPYID contains the copy ID of the package.

If the DEPLEVEL bind option is PACKAGE, COPYID is null.

End of change
G
Start of changeVALIDEnd of change Start of changeCHAR(1) WITH DEFAULT NULLEnd of change Start of changeWhether the statement is valid:
A
An ALTER statement changed the description of the table or base table of a view referred to by the statement. The changes do not invalidate the statement. However, a rebind might be required for the statement to pick up the changes from the ALTER statement.
N
No
Y
Yes
NULL
The statement-level validity is unknown. Refer to the value of the VALID column of the SYSPACKAGE table for the package-level validity.
End of change
Start of changeGEnd of change
Start of changeFL 509 STMT_HASHID2End of change Start of changeCHAR(8) NOT NULL WITH DEFAULT FOR BIT DATAEnd of change Start of change

The hash key generated by the normalized SQL statement text, selected bind options, and the COLLID and PACKAGE name values. The VERSION name is excluded.

This hash key is applicable to static SQL statements only.

The '00'x default value indicates that no hash key was generated for the SQL statement when the package was bound.

End of change
Start of changeGEnd of change
Start of changeFL 509 STMT_HASH2VEREnd of change Start of changeINTEGER NOT NULL WITH DEFAULT -1End of change Start of change

The hash version of the STMT_HASHID2 value.

The default value -1 indicates that no hash key was generated for the SQL statement when the package was bound.

End of change
Start of changeGEnd of change