Example Query - Analytics Database - Teradata Vantage

SQL External Routine Programming

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
iiv1628111441820.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
B035-1147
lifecycle
latest
Product Category
Teradata Vantage™

Here is a sample of how to invoke the table function with constant expression input arguments:

SELECT *
FROM TABLE (extract_field('25,2:9005,7896,9004,7839;36,1:737,9387;',
    25)) AS t1;

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

SELECT DISTINCT cust.Customer_ID, cust.Item_ID
FROM raw_cust,
     TABLE (extract_field(raw_cust.pending_data, 25))
AS cust
WHERE raw_cust.region = 1;

Here is the definition of the raw_cust table:

CREATE SET TABLE RGS.raw_cust ,NO FALLBACK ,
     NO BEFORE JOURNAL,
     NO AFTER JOURNAL,
     CHECKSUM = DEFAULT
     (
      region INTEGER,
      pending_data VARCHAR(32000) CHARACTER SET LATIN NOT CASESPECIFIC)
PRIMARY INDEX ( region );

Here is a sample of the data in the raw_cust table:

     region pending_data
----------- ---------------------------------------------------------
          2 7,2:879,3788,879,4500,390,9004;08,1:500,9056;
          1 25,3:9005,3789,9004,4907,398,9004;36,2:738,9387,738,9550;
          1 25,2:9005,7896,9004,7839;36,1:737,9387;