The ARRAYTABLE function processes an array input to produce tabular output. The function itself defines what columns it projects. The ARRAYTABLE function is implicitly a nested table and may be correlated to preceding FROM clause entries.

Usage

ARRAYTABLE(expression COLUMNS <COLUMN>, ...) AS name
 
COLUMN := name datatype
SQL

Parameters

ParameterDescription
expression

The array to process, which should be one of the following:

  • a java.sql.Array;
  • java array value;
  • an array constructed using ARRAY():
ARRAY('1', 2.2, 3)
CODE

 Syntax Rules

  • The column names may not contain duplicates.

Examples

1. As a nested table:

SELECT x.* FROM (CALL source.invokeMDX('some query')) r, ARRAYTABLE(r.tuple COLUMNS first STRING, second BIGDECIMAL) x
CODE

2. Using ARRAY():

SELECT * FROM ARRAYTABLE(ARRAY('1', 2.2, 3) COLUMNS d STRING, e DOUBLE, f INTEGER) a 
SQL