16.20 - transform_group - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-24
dita:mapPath
wkf1512081455740.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval

A mandatory name for the transform group.

You can create or replace up to 16 transform groups per UDT. The first transform group you specify is the default transform group. A UDT cannot have two transform groups with the same name.

The name of a transform group cannot begin with the characters TD_, which are reserved as a transform group name prefix for internal use. For information about naming database objects, see Teradata Vantage™ SQL Fundamentals, B035-1141.

UDT transform names need not be unique across UDTs.

Transform group names are stored in DBC.UDTTransform, not in DBC.TVM.
SYSUDTLIB
Optional specification of containing database.

Example: Creating Multiple Transform Groups

Create the functions for the FROM SQL WITH and TO SQL WITH clauses. This example uses functions for integer, character, and binary values.

CREATE FUNCTION SYSUDTLIB.xmld_struct2int_fromsql(xmld_struct2)
RETURNS INTEGER
NO SQL
CALLED ON NULL INPUT
PARAMETER STYLE SQL
DETERMINISTIC
LANGUAGE C
EXTERNAL NAME 'CS!xmld_struct2int_fromsql!xmld_struct2int_fromsql.c!F!xmld_struct2int_fromsql';
CREATE FUNCTION SYSUDTLIB.xmld_struct2int_tosql(INTEGER)
RETURNS xmld_struct2
NO SQL
PARAMETER STYLE TD_GENERAL
RETURNS NULL ON NULL INPUT
DETERMINISTIC
LANGUAGE C
EXTERNAL NAME 'CS!xmld_struct2int_tosql!xmld_struct2int_tosql.c!F!xmld_struct2int_tosql';
CREATE FUNCTION SYSUDTLIB.xmld_struct2char_fromsql(xmld_struct2)
RETURNS CHAR
NO SQL
CALLED ON NULL INPUT
PARAMETER STYLE SQL
DETERMINISTIC
LANGUAGE C
EXTERNAL NAME 'CS!xmld_struct2char_fromsql!xmld_struct2char_fromsql.c!F!xmld_struct2char_fromsql';
CREATE FUNCTION SYSUDTLIB.xmld_struct2char_tosql(CHAR)
RETURNS xmld_struct2
NO SQL
PARAMETER STYLE TD_GENERAL
RETURNS NULL ON NULL INPUT
DETERMINISTIC
LANGUAGE C
EXTERNAL NAME 'CS!xmld_struct2char_tosql!xmld_struct2char_tosql.c!F!xmld_struct2char_tosql';
CREATE FUNCTION SYSUDTLIB.xmld_struct2byte_fromsql(xmld_struct2)
RETURNS BYTE
NO SQL
CALLED ON NULL INPUT
PARAMETER STYLE SQL
DETERMINISTIC
LANGUAGE C
EXTERNAL NAME 'CS!xmld_struct2byte_fromsql!xmld_struct2byte_fromsql.c!F!xmld_struct2byte_fromsql';
CREATE FUNCTION SYSUDTLIB.xmld_struct2byte_tosql(BYTE)
RETURNS xmld_struct2
NO SQL
PARAMETER STYLE TD_GENERAL
RETURNS NULL ON NULL INPUT
DETERMINISTIC
LANGUAGE C
EXTERNAL NAME 'CS!xmld_struct2byte_tosql!xmld_struct2byte_tosql.c!F!xmld_struct2byte_tosql';
This statement creates three transform groups:
CREATE TRANSFORM FOR XMLD_STRUCT2
XMLD_STRUCT2INT (TO SQL WITH SPECIFIC FUNCTION SYSUDTLIB.XMLD_STRUCT2INT_TOSQL,
                 FROM SQL WITH SPECIFIC FUNCTION SYSUDTLIB.XMLD_STRUCT2INT_FROMSQL)
XMLD_STRUCT2CHAR(TO SQL WITH SPECIFIC FUNCTION SYSUDTLIB.XMLD_STRUCT2CHAR_TOSQL,
                 FROM SQL WITH SPECIFIC FUNCTION SYSUDTLIB.XMLD_STRUCT2CHAR_FROMSQL)
XMLD_STRUCT2BYTE(TO SQL WITH SPECIFIC FUNCTION SYSUDTLIB.XMLD_STRUCT2BYTE_TOSQL,
                 FROM SQL WITH SPECIFIC FUNCTION SYSUDTLIB.XMLD_STRUCT2BYTE_FROMSQL);