Example: USING and SQL UDF Invocation - Teradata Database - Teradata Vantage NewSQL Engine

SQL Data Manipulation Language

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-03
dita:mapPath
fbo1512081269404.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata Vantage™

This example invokes the SQL UDF value_expression in a USING clause-based SELECT request.

     USING (a INTEGER, b INTEGER)
     SELECT test.value_expression(:a, :b) AS cve
     FROM t1
     WHERE t1.a1 = :a
     AND   t1.b1 = :b;

This example invokes the SQL UDF value_expression in a USING clause-based DELETE request.

     USING (a INTEGER, b INTEGER)
     DELETE FROM t1
     WHERE test.value_expression(:a, :b) > t1.a1;

This example, which invokes the SQL UDF value_expression in a USING clause-based SELECT request with mismatches of the data types of the arguments, aborts and returns an error.

     USING (a CHARACTER(10), b CHARACTER(10))
     SELECT test.value_expression(:a, :b) AS cve
     FROM t1
     WHERE t1.a1 = :a
     AND   t1.b1 = :b;