17.10 - CREATE TYPE構文(STRUCTURED形式) - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQLデータ定義言語 構文規則および例

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
2021年7月
Content Type
プログラミング リファレンス
Publication ID
B035-1144-171K-JPN
Language
日本語 (日本)
CREATE TYPE [ SYSUDTLIB. ] UDT_name AS ( attribute_specification [,...] )
  [ INSTANTIABLE ] NOT FINAL [ method_specification [,...] ] [;]
attribute_specification
attribute_name {
  predefined_data_type [ CHARACTER SET server_character_set ] |
  UDT_name
}
method_specification
[ INSTANCE | CONSTRUCTOR ] 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 [...]
language_and_access_specificationtype_attributeは、逆の順序で指定できます。
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 ]
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] ) |

  PERIOD (DATE) |

  PERIOD ({ TIME | TIMESTAMP } [(precision)] [ WITH TIME ZONE ]) |

  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 ]) |

  [SYSUDTLIB.] { XML | XMLTYPE } [(integer [ G | K | M ])]
    [ INLINE LENGTH integer ] |

  [SYSUDTLIB.] JSON [(integer [ K | M ])] [ INLINE LENGTH integer ]
    [ CHARACTER SET { UNICODE | LATIN } ] |

  [SYSUDTLIB.] ST_GEOMETRY [(integer [ K | M ])] [ INLINE LENGTH integer ] |

  [SYSUDTLIB.] { UDT_name | MBR }
}
language_and_access_specification
language_clause SQL_data_access
language_and_access_specificationtype_attributeの前の場合、language_clauseSQL_data_accessは逆の順序で指定できます。
type_attribute
{ SPECIFIC [ SYSUDTLIB. ] specific_method_name |
  PARAMETER STYLE { SQL | TD_GENERAL } |
  [NOT] DETERMINISTIC |
  CALLED ON NULL INPUT |
  RETURNS NULL ON NULL INPUT  
}