DB2 Version 10.1 for Linux, UNIX, and Windows

TYPE_NAME scalar function

The TYPE_NAME function returns the unqualified name of the dynamic data type of the expression.

Read syntax diagramSkip visual syntax diagram
>>-TYPE_NAME--(--expression--)---------------------------------><

The schema is SYSIBM.

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

The data type of the result of the function is VARCHAR(18). If expression can be null, the result can be null; if expression is null, the result is the null value. Use the TYPE_SCHEMA function to determine the schema name of the type name returned by TYPE_NAME.

Notes

Example

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 type of the row that corresponds to the reference.
   SELECT TASK, WHO_RESPONSIBLE->NAME,
       TYPE_NAME(DEREF(WHO_RESPONSIBLE)),
       TYPE_SCHEMA(DEREF(WHO_RESPONSIBLE))
     FROM ACTIVITIES
The DEREF function is used to return the object corresponding to the row.