Creating Multi-dimensional Arrays

From InterBase

Go Up to Creating Arrays


InterBase supports multi-dimensional arrays, arrays with 1 to 16 dimensions. For example, the following statement defines three integer array columns with two, three, and six dimensions, respectively:

EXEC SQL
CREATE TABLE TABLE1
(
INT_ARR2 INTEGER[4,5]
INT_ARR3 INTEGER[4,5,6]
INT_ARR6 INTEGER[4,5,6,7,8,9]
);

In this example, INT_ARR2 allocates storage for 4 rows, 5 elements in width, for a total of 20 integer elements, INT_ARR3 allocates 120 elements, and INT_ARR6 allocates 60,480 elements.

Important:
InterBase stores multi-dimensional arrays in row-major order. Some host languages, such as FORTRAN, expect arrays to be in column-major order. In these cases, care must be taken to translate element ordering correctly between InterBase and the host language.

Advance To: