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

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1144-171K
Language
English (United States)

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.