SQL User-Defined Functions and Large Objects - Advanced SQL Engine - Teradata Database

SQL Data Definition Language Detailed Topics

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
imq1591724555718.ditamap
dita:ditavalPath
imq1591724555718.ditaval
dita:id
B035-1184
lifecycle
previous
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.