Array data types
- Last Updated: March 30, 2020
- 2 minute read
- OpenEdge
- Version 12.2
- Documentation
Array data types
The ARRAY data type is a composite
data value that consists of zero or more elements of a specified
data type (known as the element type). VARARRAY data
type allows the size of an individual element value to exceed its
declared size as long as the total size of the array is smaller
than the array's SQL width.
The VARARRAY type
is most compatible with the ABL array data definitions. For best
compatibility with the ABL, use the VARARRAY type.
The ARRAY type is less ABL compatible and more
SQL standard compliant.
Syntax
This is the syntax for the array data type:
|
Parameters
- data_type
-
The data type of the array. This is also known as the element type.
Supported data types are:
BINARY, BIT, CHAR, VARCHAR, DATE, DECIMAL, DOUBLE PRECISION, FLOAT, INTEGER, NUMERIC, REAL, SMALLINT, TIME, TIMESTAMP, TIMESTAMP_TZ, TINYINT,andVARBINARY. - [int]
-
An unsigned integer, indicating the array's maximum element size.
Notes
- OpenEdge SQL limits an array's size. The array's size must be an integer between 1 and 9999.
- Array columns and element references cannot be indexed because:
- You cannot define a
UNIQUEkey with columns of typeARRAY. - You cannot define a
PRIMARYkey with columns of typeARRAY. - You cannot define a
FOREIGNkey with columns of typeARRAY.
- You cannot define a
- Array columns and element references cannot be used in
GROUP BYclauses.
Example
In
this example, table TBL is created. TBL has two columns: column
C1 is an array of up to 3 elements, all of them type int and column
C2 is a variable-sized array of up to 4 elements, all of them type varchar:
|
The size of any element in C2 can be up to 20 characters (5*4) with a total size of 20 characters.