Java Constant/Variable Mode Table Function | UFC Code Examples | Vantage - Java Constant/Variable Mode Table Function - Advanced SQL Engine - Teradata Database

SQL External Routine Programming

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
qwr1571437338192.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1147
lifecycle
previous
Product Category
Teradata Vantage™

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.