Multi-dimensional Arrays

From InterBase

Go Up to Defining 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 four dimensions respectively:

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

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_ARR4 allocates 840 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: