TYPE_ID scalar function

The TYPE_ID function returns the internal type identifier of the dynamic data type of the expression.

Read syntax diagramSkip visual syntax diagramTYPE_ID(expression)

The schema is SYSIBM.

An expression that returns a value of a user-defined structured data type.

The data type of the result of the function is INTEGER. If expression can be null, the result can be null; if expression is null, the result is the null value.

The value returned by the TYPE_ID function is not portable across databases. The value may be different, even though the type schema and type name of the dynamic data type are the same. When coding for portability, use the TYPE_SCHEMA and TYPE_NAME functions to determine the type schema and type name.


  • This function cannot be used as a source function when creating a user-defined function. Because it accepts any structured data type as an argument, it is not necessary to create additional signatures to support different user-defined types.


A table hierarchy exists having root table EMPLOYEE of type EMP and subtable MANAGER of type MGR. Another table ACTIVITIES includes a column called WHO_RESPONSIBLE that is defined as REF(EMP) SCOPE EMPLOYEE. For each reference in ACTIVITIES, display the internal type identifier of the row that corresponds to the reference.
The DEREF function is used to return the object corresponding to the row.