Unpack Function Example | Teradata Vantage - 17.05 - Unpack Example: More Input Columns than Output Columns - Teradata Database

Teradata Vantage™ - Advanced SQL Engine Analytic Functions

prodname
Advanced SQL Engine
Teradata Database
vrm_release
17.00
17.05
created_date
June 2020
category
Programming Reference
featnum
B035-1206-170K

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