SQL User-Defined Functions and Large Objects - Analytics Database - Teradata Vantage

SQL Data Definition Language Detailed Topics

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-07-11
dita:mapPath
vuk1628111288877.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1184
lifecycle
latest
Product Category
Teradata Vantage™

The usage characteristics for an SQL UDF with large object parameters or a large object return value are the same as the usage characteristics for any other UDF. In general, you can specify a UDF that accepts a LOB value as an argument in any context in which a UDF is otherwise allowed. You can also use an SQL UDF that returns a LOB value in any context in which a value of that type is appropriate and a UDF is otherwise allowed.

As with other functions and operators, Vantage can apply automatic type conversions to the arguments or the return values of an SQL UDF. You should be careful about the possible performance implications of automatic type conversions with large objects used as UDF parameters.

For example, a function whose formal parameter is a BLOB type could be passed a VARBYTE column as the actual argument. Vantage converts the VARBYTE value into a temporary BLOB and then passes that to the SQL UDF. Because even a temporary BLOB is stored on disk, the performance cost of the conversion is significant. To avoid this, you should consider creating an overloaded function that explicitly accepts a VARBYTE argument.

Another possible cause of undesired conversions is truncation. Declared length is part of the data type specification.