Example: Concatenating 1-D ARRAY values - Advanced SQL Engine - Teradata Database

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-22
dita:mapPath
zsn1556242031050.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantageā„¢

This example takes two 1-D ARRAY values of the same data type and concatenates them together.

CREATE TYPE address AS CHAR(10) ARRAY[5];
CREATE TABLE employee_info (eno INTEGER, addressval address);
/* Assume one row in table employee_info contains the following value 
for "addressval": 
Addressval[1] = '123 Main St.'
Addressval[2] = 'San Diego'
Addressval[3] = 'CA'
*/
/* The following select statement concatenates the current value in "addressval" with ZIP code and country information, which are stored as additional elements of the 1-D array. */
SELECT addressval || NEW address('92101', 'USA');
FROM employee_info;
/* Result value is the following:
Addressval[1] = '123 Main St.'
Addressval[2] = 'San Diego'
Addressval[3] = 'CA'
Addressval[4] = '92101'
Addressval[5] = 'USA'
*/