CREATE TYPE Syntax | Teradata Vantage - CREATE TYPE Syntax (Distinct Form) - Analytics Database - Teradata Vantage

SQL Data Definition Language Syntax and Examples

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-10-04
dita:mapPath
jco1628111346878.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
mdr1472255012272
lifecycle
latest
Product Category
Teradata Vantage™
CREATE TYPE [ SYSUDTLIB. ] UDT_name AS data_type
  [ CHARACTER SET server_character_set ]
  FINAL [ method_specification ] [;]
data_type
{ INTEGER | SMALLINT | BIGINT | BYTEINT | DATE |

  { TIME | TIMESTAMP } [( fractional_seconds_precision)] [WITH TIME ZONE] |

  INTERVAL YEAR [( precision)] [TO MONTH] |

  INTERVAL MONTH [( precision)] |

  INTERVAL DAY [( precision)]
    [TO { HOUR | MINUTE | SECOND [(fractional_seconds_precision)] } ] |

  INTERVAL HOUR [(precision)]
    [TO { MINUTE | SECOND [(fractional_seconds_precision)] } ] |

  INTERVAL MINUTE [(precision)] [ TO SECOND [(fractional_seconds_precision)] ] |

  INTERVAL SECOND [ ( precision [, fractional_seconds_precision ] ) |

  REAL |

  DOUBLE PRECISION |

  FLOAT [(integer)] |

  NUMBER [({ integer | *} [, integer ]...)] |

  { DECIMAL | NUMERIC } [(integer [, integer ]...)] |

  { CHAR | BYTE | GRAPHIC } [(integer)] |

  { VARCHAR | CHAR VARYING | VARBYTE | VARGRAPHIC } [(integer)] |

  LONG VARCHAR |

  LONG VARGRAPHIC |

  { BINARY LARGE OBJECT | BLOB | CHARACTER LARGE OBJECT | CLOB }
    (integer [ G | K | M ])
}
method_specification
[ INSTANCE ] METHOD [ SYSUDTLIB. ] method_name
  ( parameter_specification [,...] )
  RETURNS returns_parameter_specification [ AS LOCATOR ]
  [ CAST FROM { data_type | [ SYSUDTLIB. ] UDT_name } [ AS LOCATOR ] ]
  [ SPECIFIC [ SYSUDTLIB. ] specific_method_name ]
  [ SELF AS RESULT ]
  language_and_access_specification
  type_attribute [...]
You can specify language_and_access_specification and type_attribute in the reverse order.
parameter_specification
[ parameter_name ] {
  data_type [ CHARACTER SET server_character_set ] |
  [ SYSUDTLIB. ] UDT_name
} [ AS LOCATOR ]
returns_parameter_specification
data_type [ CHARACTER SET server_character_set ] |
  [ SYSUDTLIB. ] UDT_name
} [ AS LOCATOR ]
language_and_access_specification
language_clause SQL_data_access
If language_and_access_specification is before type_attribute, you can specify language_clause and SQL_data_access in the reverse order.
type_attribute
{ SPECIFIC [ SYSUDTLIB. ] specific_method_name |
  PARAMETER STYLE { SQL | TD_GENERAL } |
  [NOT] DETERMINISTIC |
  CALLED ON NULL INPUT |
  RETURNS NULL ON NULL INPUT  
}