Specifying field procedures

To transform values in single, short string columns, you can assign field procedures to the columns. If you plan to use a field procedure, specify it when you create the table. In operation, the procedure is loaded on demand.

About this task

Begin program-specific programming interface information.
Restriction: Consider the following restrictions:
  • You cannot use a field procedure on a column that was defined by using the NOT NULL WITH DEFAULT clause.
  • You cannot add a field procedure to an existing column of a table. However, you can use the ALTER TABLE statement to add a new column that uses a field procedure to an existing table.
  • You cannot use a field procedure on a LOB, ROWID, or ROW CHANGE TIMESTAMP column of a table. However, you can specify it for other columns in the same table.
  • You cannot use a field procedure on a column if the column name is longer than 18 EBCDIC bytes.

Procedure

To specify a field procedure for a column:

Issue the CREATE TABLE or ALTER TABLE statement with the FIELDPROC clause.

The optional parameter list that follows the procedure name is a list of constants, enclosed in parentheses, called the literal list. The literal list is converted by DB2® into a data structure called the field procedure parameter value list (FPPVL). That structure is passed to the field procedure during the field-definition operation. At that time, the procedure can modify it or return it unchanged. The output form of the FPPVL is called the modified FPPVL. The modified FPPVL is stored in the DB2 catalog as part of the field description. The modified FPPVL is passed again to the field procedure whenever that procedure is invoked for field-encoding or field-decoding.

End program-specific programming interface information.