TYPE_NAME scalar function
The TYPE_NAME function returns the unqualified name of the dynamic data type of the 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(128 OCTETS). 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
- 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.
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.