16.20 - Unpack Example: More Input Columns than Output Columns - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ - NewSQL Engine Analytic Functions

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Release Date
July 2019
Content Type
Programming Reference
Publication ID
B035-1206-162K
Language
English (United States)

Input

The input table is ville_tempdata1, as in Unpack Example: No Delimiter Separates Virtual Columns. Its packed_temp_data column has three virtual columns.

SQL Call

The OutputColumns syntax element specifies only two output column names.

SELECT * FROM Unpack (
  ON ville_tempdata1
  USING
  TargetColumn ('packed_temp_data')
  OutputColumns ('city', 'state')
  OutputDataTypes ('varchar', 'varchar')
  ColumnLength ('9', '9') 
  Regex ('(.*)')
  RegexSet (1)
  IgnoreInvalid ('true')
) AS dt ORDER BY sn;

Output

The output table has columns for the first two virtual input columns, but not for the third.

city state sn
Nashville Tennessee 10
Nashville Tennessee 11
Nashville Tennessee 12
Nashville Tennessee 13
Nashville Tennessee 14
Nashville Tennessee 15
Nashville Tennessee 16
Nashville Tennessee 17
Nashville Tennessee 18
Nashville Tennessee 19