17.05 - Example: USING and SQL UDF Invocation - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1146-175K
Language
English (United States)

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;