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

Teradata Vantage™ - SQL External Routine Programming

Advanced SQL Engine
Teradata Database
Release Number
Release Date
April 2020
Content Type
Programming Reference
Publication ID
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;

  • <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.