Example Query - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
rin1593638965306.ditamap
dita:ditavalPath
rin1593638965306.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantageā„¢

Here is an example of how to invoke the table function with constant expression input arguments and get a result row with four columns:

SELECT *
FROM TABLE (get_data('1356,122,20061009,abc')
RETURNS (col1 INTEGER, col2 BYTEINT, col3 DATE, col4 VARCHAR(5)))
AS t1;

Here is another example of how to invoke the table function with constant expression input arguments and get a result row with three columns:

SELECT *
FROM TABLE (get_data('1234,56,20061010')
RETURNS (col1 INTEGER, col2 BYTEINT, col3 DATE))
AS t1;

Here is an example of how to invoke the table function using the columns from a derived table as input arguments:

SELECT tf.col1, tf.col2, tf.col3, tf.col4
FROM raw_cust,
     TABLE (get_data(raw_cust.text)
RETURNS (col1 INTEGER, col2 BYTEINT, col3 DATE, col4 VARCHAR(5)))
AS tf;

Here is the definition of the raw_cust table:

CREATE TABLE raw_cust (C1 INT, text VARCHAR(30));

INSERT INTO raw_cust (1,'1356,122,20061009,abc');