Type Conversion and Performance - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™

As it does with other functions and operators, Teradata Database performs implicit conversion of types that are compatible with LOBs according to the rules of precedence. If you define a UDF that declares a LOB type parameter, you can call the UDF and pass a compatible argument.

IF the UDF declares this parameter type … THEN you can call the UDF and pass this argument type …
CLOB
  • VARCHAR
  • CHAR
BLOB
  • VARBYTE
  • BYTE

In some cases, implicit conversions of types that are compatible with LOBs have performance consequences.

For example, suppose a UDF declares a BLOB parameter. If you call the UDF and pass in a VARBYTE column, Teradata Database converts the VARBYTE value into a temporary BLOB and passes it to the UDF. Because Teradata Database stores the temporary BLOB on disk, the performance cost of the conversion is significant.

A solution is to create an overloaded function that explicitly declares a VARBYTE argument.