Commenting on UDT and Method Definitions - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Published
January 2021
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
ncd1596241368722.ditamap
dita:ditavalPath
hoy1596145193032.ditaval
dita:id
B035-1144
lifecycle
previous
Product Category
Teradata Vantage™

The following example set shows how to place comments on a UDT or method:

UDT and Method Definitions for Examples

Suppose you define the following UDT and method.

    CREATE TYPE address AS (
      street VARCHAR(20), 
      zip CHARACTER(5) ) 
    NOT FINAL
    CONSTRUCTOR METHOD address( a VARCHAR(20), 
                                b CHARACTER(5) ) 
    RETURNS address
    SPECIFIC address_constructor_1
    SELF AS RESULT
    LANGUAGE C
    PARAMETER STYLE SQL
    DETERMINISTIC
    NO SQL;
    CREATE CONSTRUCTOR METHOD address( VARCHAR(20), 
                                       CHARACTER(5) )
    RETURNS address
    FOR address
    EXTERNAL NAME 
      'SO!C:\structured_lib\addr_cons.obj!F!addr_constructor';

Example: Commenting on a UDT Definition

The following request places a comment on the UDT named address:

    COMMENT ON TYPE address   
    AS   'Type containing the Street Address and Zipcode' ;

Because the object kind for this request is TYPE, you must specify the keyword TYPE for the object kind when you code it.

Example: Commenting on a Method Definition

The following request places a comment on the constructor method named address_constructor_1:

    COMMENT ON METHOD address_constructor_1  
    AS   'Constructor for the Address UDT'  ;

Because the object kind for this request is METHOD, you must specify the keyword METHOD for the object kind when you code it.

Also note that the method name must specify the specific name of the method rather than its calling name. See CREATE METHOD for further information about the calling name and the specific name for a method.