Example: Query a 2-D ARRAY Data Type and Table using OLIMIT - Advanced SQL Engine - Teradata Database

SQL Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
tpf1598412463935.ditamap
dita:ditavalPath
tpf1598412463935.ditaval
dita:id
B035-1143
lifecycle
previous
Product Category
Teradata Vantageā„¢

Consider the following 2-D ARRAY data type and table.

CREATE TYPE shot_ary AS VARRAY(1:50)(1:50) OF INTEGER;
CREATE TABLE seismic_table (
   id INTEGER,
   shots shot_ary);

The table is populated with the following values:

/* The first 2 elements are populated; the rest are uninitialized. */
INSERT INTO seismic_table VALUES (1, shot_ary(11, 12));
/* Empty ARRAY instance */
INSERT INTO seismic_table VALUES (2, shot_ary());

The following query returns the highest possible subscript value in the shots array.

SELECT id, shots.OLIMIT()
FROM seismic_table;

The following is the result of the query.

ID          shots.OLIMIT()
--          --------------
 1           NEW arrayVec(50,50)
 2           NEW arrayVec(50,50)