CREATE TYPE

statementsupportedTables, views, streams, sequences

docs.snowflake.com ↗

Object: TYPE

Creates a user-defined type.

Syntax

supportedpartialnot supportednot scored

CREATE [ OR REPLACE ] TYPE [ IF NOT EXISTS ] <name> AS <type>
  [ COMMENT = '<string_literal>' ]

Parameters

NameRequiredDescription
namerequiredSpecifies the identifier for the user-defined type; must be unique for the schema in which the user-defined type is created. The name can’t be the same as a Snowflake type name. For example, the type name can’t be array or geometry. If the name is the same as a Snowflake keyword, it must be specified in double quotes. In addition, the identifier must start with an alphabetic character and cannot contain spaces or special characters unless the entire identifier string is enclosed in double quotes (for example, "My object"). Identifiers enclosed in double quotes are also case-sensitive. For more information, see Identifier requirements.
AS typerequiredAn existing Snowflake data type definition. The specified type definition is the base type for the user-defined type being created. type can’t be another user-defined type.
COMMENT = 'string_literal'optionalSpecifies a comment for the user-defined type. Default: No value

Usage notes

Access control requirements

A role used to execute this operation must have the following privileges at a minimum: Privilege | Object | Notes CREATE TYPE | Schema | Operating on an object in a schema requires at least one privilege on the parent database and at least one privilege on the parent schema. For instructions on creating a custom role with a specified set of privileges, see Creating custom roles. For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.

See also

Referenced by