TYPES view

This Information Schema view displays a row for each user-defined type defined in the specified or current database.

See also:

TYPES view (Account Usage) , TYPES view (Organization Usage)

Columns

Column nameData typeDescription
TYPE_CATALOGVARCHARDatabase that contains the type.
TYPE_SCHEMAVARCHARSchema that contains the type.
TYPE_NAMEVARCHARName of the type.
TYPE_OWNERVARCHARName of the role that owns the type.
BASE_DATA_TYPEVARCHARUnderlying data type of the user-defined type.
CHARACTER_MAXIMUM_LENGTHNUMBERMaximum length in characters for VARCHAR types.
CHARACTER_OCTET_LENGTHNUMBERMaximum length in bytes for VARCHAR types.
NUMERIC_PRECISIONNUMBERNumeric precision for NUMBER types.
NUMERIC_PRECISION_RADIXNUMBERRadix of the numeric precision for NUMBER types.
NUMERIC_SCALENUMBERNumeric scale for NUMBER types.
DATETIME_PRECISIONNUMBERFractional seconds precision for TIMESTAMP types.
CHECK_EXPRESSIONVARCHARNot applicable for Snowflake.
DEFAULT_EXPRESSIONVARCHARNot applicable for Snowflake.
IS_NULLABLE_DEFAULTVARCHARNot applicable for Snowflake.
COLLATION_NAMEVARCHARNot applicable for Snowflake.
CREATEDTIMESTAMP_LTZCreation time of the type.
LAST_ALTEREDTIMESTAMP_LTZ

Date and time the object was last altered by a DML, DDL, or background metadata operation. See Usage Notes_.

COMMENTVARCHARComment for this type.

Usage notes

  • The view only displays objects for which the current role for the session has been granted access privileges. The view doesn’t honor the MANAGE GRANTS privilege and consequently might show less information compared to a SHOW command when both are executed by a user who holds the MANAGE GRANTS privilege.
  • The LAST_ALTERED column is updated when the following operations are performed on an object:

    • DDL operations.
    • DML operations (for tables only). This column is updated even when no rows are affected by the DML statement.
    • Background maintenance operations on metadata performed by Snowflake.

Examples

Retrieve all user-defined types in the mydb database:

SELECT type_name, type_owner, base_data_type
  FROM mydb.INFORMATION_SCHEMA.TYPES;

Retrieve all user-defined types in a specific schema:

SELECT type_name, type_owner, base_data_type
  FROM mydb.INFORMATION_SCHEMA.TYPES
  WHERE type_schema = 'MY_SCHEMA';