Entering content frame

Background documentation Arrays as Host Variables Locate the document in its SAP Library structure

Host variables can be arrays. In an array statement they cause an SQL statement to be executed more than once.

In multi-dimensional arrays, the last dimension is run first.

Example

EXEC SQL BEGIN DECLARE SECTION;

float p[3][2];

EXEC SQL END DECLARE SECTION;

EXEC SQL CREATE TABLE KOORD (x float, y float);

p[0][0] = 0.0;

p[0][1] = 0.1;

p[1][0] = 1.0;

p[1][1] = 1.1;

p[2][0] = 2.0;

p[2][1] = 2.1;

EXEC SQL INSERT INTO KOORD VALUES (:p);

/* insert generates following content */

/*      x  |  y                                  */
/*     ---------                                 */
/*     0.0 | 0.1                                 */
/*     1.0 | 1.1                                 */
/*     2.0 | 2.2                                 */

Also specify the corresponding indicator variable as an array, with the same length and dimension.

Note

You can use a simplified notation for array variables in SQL statements.

 

Leaving content frame