25.09.2015 Views

Teradata Parallel Data Pump

Teradata Parallel Data Pump Reference - Teradata Developer ...

Teradata Parallel Data Pump Reference - Teradata Developer ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Appendix D: User-Defined-Types and User-Defined-Methods<br />

User-Defined-Types and User-Defined-Methods<br />

User-Defined-Methods (UDMs)<br />

<strong>Teradata</strong> <strong>Data</strong>base developer-created custom functions, which are explicitly connected to<br />

UDTs are known as User-Defined-Methods (UDMs). All UDMs must reside on server.<br />

UDMs can be used to create an interface to the UDT that is independent of the UDT's internal<br />

representation. This makes it possible to later enhance a given UDT even in cases where the<br />

internal representation of the UDT must be changed to support the enhancement, without<br />

changing all of the database applications which use the UDT.<br />

Creating UDTs with <strong>Teradata</strong> T<strong>Pump</strong><br />

<strong>Teradata</strong> T<strong>Pump</strong> cannot create a custom UDT.<br />

Inserting and Retrieving UDTs with Client Products<br />

External Types<br />

A UDT can only exist on the <strong>Teradata</strong> <strong>Data</strong>base server. Each UDT has an associated “from-sql<br />

routine” and “to-sql routine”.<br />

• Insert - The “to-sql routine” constructs a UDT value from a pre-defined type value. The<br />

“to-sql routine” is automatically invoked when inserting values from a client system into a<br />

UDT on the <strong>Teradata</strong> <strong>Data</strong>base server.<br />

• Retrieve - The “from-sql routine” generates a pre-defined type value from a UDT. The<br />

“from-sql routine” is automatically invoked when a UDT is retrieved from the <strong>Teradata</strong><br />

<strong>Data</strong>base server to a client system.<br />

The “from-sql routine” and the “to-sql routine” create a mapping between a UDT and a predefined<br />

type. This pre-defined type is called the external type of a UDT. A client application<br />

only deals with the external type; it does not deal with UDT value directly.<br />

External Type Example<br />

For example, if the following conditions exist:<br />

• UDT named FULLNAME exists<br />

• The external type associated with FULLNAME is VARCHAR(46)<br />

Then, during an retrieve of FULLNAME values, the <strong>Teradata</strong> <strong>Data</strong>base server converts the<br />

values from FULLNAME values to VARCHAR(46) values by invoking the “from-sql routine”<br />

associated with the FULLNAME UDT.<br />

Note: The client must expect to receive the data in the same format as it receives<br />

VARCHAR(46) values.<br />

Similarly, when values are provided by the client for insert into a FULLNAME UDT, the client<br />

must provide values in the same way it would provide values for a VARCHAR(46) field. The<br />

<strong>Teradata</strong> <strong>Data</strong>base server will convert the values from VARCHAR(46) to FULLNAME values<br />

using the “to-sql routine” associated with the FULLNAME UDT.<br />

258 <strong>Teradata</strong> <strong>Parallel</strong> <strong>Data</strong> <strong>Pump</strong> Reference

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!