16.20 - 例: 2つの1-D ARRAY値の連結 - Teradata Vantage NewSQL Engine

Teradata Vantage™ データ タイプおよびリテラル

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
プログラミング リファレンス
featnum
B035-1143-162K-JPN

この例では、同じデータ型の1-D ARRAY値を2つ受け取り、それを連結します。PhoneNumとOldPhoneNumはemployee_infoテーブル内の列で、どちらの列も同じ1-D ARRAYデータ型です。

/* 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'
*/

次に、メソッドスタイルの構文を使用した同じ問合わせを示します。

SELECT PhoneNum.ARRAY_CONCAT(OldPhoneNum)
FROM employee_info;