ARRAYTABLE

Page edited by Steven Hawkins


Changes (1)

...
ARRAYTABLE is effectively a shortcut for using the [Miscellaneous Functions#array_get|Miscellaneous Functions#array_get] function in a nested table. For example

{code:lang=SQL}ARRAYGET(val {code:lang=SQL}ARRAYTABLE(val COLUMNS col1 string, col2 integer) AS X{code}

is the same as
...

Full Content

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

Parameters

  • expression - the array to process, which should be a java.sql.Array or java array value.
    Syntax Rules:
  • The columns names must be not contain duplicates.

Examples

  • As a nested table:
    select x.* from (call source.invokeMDX('some query')) r, arraytable(r.tuple COLUMNS first string, second bigdecimal) x

ARRAYTABLE is effectively a shortcut for using the Miscellaneous Functions#array_get function in a nested table. For example

ARRAYTABLE(val COLUMNS col1 string, col2 integer) AS X

is the same as

TABLE(SELECT cast(array_get(val, 1) AS string) AS col1, cast(array_get(val, 2) AS integer) AS col2) AS X
Stop watching space | Change email notification preferences
View Online | View Changes | Add Comment