16.20.16.20 - 16.20 - Example: Concatenating Two 1-D ARRAY Values - Teradata Vantage NewSQL Engine

Teradata Vantageā„¢ Data Types and Literals

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1143-162K

This example takes two 1-D ARRAY values of the same data type and concatenates them together. PhoneNum and OldPhoneNum are columns in the employee_info table, and both columns have the same 1-D ARRAY data type.

/* The following select statement concatenates the current value in "PhoneNum" with the value in "OldPhoneNum". */
/* Assume one row in table employee_info contains the following value for "PhoneNum": 
PhoneNum[1] = '6197211000'
PhoneNum[2] = '6197221000'
PhoneNum[3] = '6197231000'
Also, assume one row in table employee_info contains the following value for "OldPhoneNum": 
OldPhoneNum[1] = '8582001000'
OldPhoneNum[2] = '8582002000'
OldPhoneNum[3] = '8582003000'
*/
SELECT ARRAY_CONCAT(PhoneNum, OldPhoneNum)
FROM employee_info;
/* Result value is the following:
PhoneNum[1] = '6197211000'
PhoneNum[2] = '6197221000'
PhoneNum[3] = '6197231000'
PhoneNum[4] = '8582001000'
PhoneNum[5] = '8582002000'
PhoneNum[6] = '8582003000'
*/

The following shows the same query using method-style syntax:

SELECT PhoneNum.ARRAY_CONCAT(OldPhoneNum)
FROM employee_info;