16.20 - Java Constant/Variable Mode Table Function - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
April 2020
Content Type
Programming Reference
Publication ID
B035-1147-162K
Language
English (United States)

This example shows the Java code for a table function that supports both Tbl.TBL_MODE_CONST and the Tbl.TBL_MODE_VARY modes. The Tbl.TBL_MODE_CONST is very simple in that any one AMP will extract the data out of the text string that is passed in.

This example extracts some data out of a 'raw' text field to generate a bunch of rows. The raw data is supposed to be of the form of numbers as follows:

<store number>,<entries>:<customer ID>,<item ID>, ...; repeat;

where:
  • <store number> is the store that sold these items to customers
  • <entries> is the number of items that were sold
  • <customer ID>,<item ID> are the tuples repeated <entries> times ending with a ';' where the whole pattern can repeat.