SYSPROCBODY

The sysprocbody system catalog table describes the compiled version of each procedure or function in the database. Because the sysprocbody table stores the text of the routine, each routine can have multiple rows. The sysprocbody table has the following columns.
Table 1. SYSPROCBODY table column descriptions
Column Type Explanation
procid INTEGER Unique identifying code for the routine
datakey CHAR(1) Type of information in the data column:
  • A = Routine alter SQL (will not change this value after update statistics)
  • D = Routine user documentation text
  • E = Time of creation information
  • L = Literal value (that is, literal number or quoted string)
  • P = Interpreter instruction code (p-code)
  • R = Routine return value type list
  • S = Routine symbol table
  • T = Routine text creation SQL
seqno INTEGER Line number within the routine
data CHAR(256) Actual text of the routine

The A flag indicates the procedure modifiers are altered. ALTER ROUTINE statement updates only modifiers and not the routine body. UPDATE STATISTICS updates the query plan and not the routine modifiers, and the value of datakey will not be changed from A. The A flag marks all the procedures and functions that have altered modifiers, including overloaded procedures and functions. The T flag is used for routine creation text.

The data column contains actual data, which can be in one of these formats:
  • Encoded return values list
  • Encoded symbol table
  • Literal data
  • P-code for the routine
  • Compiled code for the routine
  • Text of the routine and its documentation

A composite index on the procid, datakey, and seqno columns allows only unique values.