Progress
Embedded SQL-92
Guide and Reference


Type Specifications for Static Array Types

Declares a static array or array type consisting of elements of any data type. This array declaration must be within a BEGIN-END DECLARE SECTION.

SYNTAX

{  variable_name  [  , ...  ]  |  TYPE new_type_name  }
  IS AN ARRAY OF type_name WITH SIZE constant_id ; 

variable_name

C Language variable name.

TYPE new_type_name

Identifies the data type of the array being declared.

IS AN ARRAY OF type_name

Identifies the data type of the array being declared.

WITH SIZE constant_id

A constant defining the dimension or size of the array.

NOTES

EXAMPLE

This example illustrates how to refer to an array element in an SQL-92 statement:

EXEC SQL BEGIN DECLARE SECTION ;
#define     NAMESZ     20
#define     ARRAYSZ    10
cust_name_t IS AN ARRAY OF char WITH SIZE NAMESZ ;
cust_name   IS AN ARRAY of cust_name_t WITH SIZE ARRAYSZ ;
EXEC SQL END DECLARE SECTION ;
   .
   .
   .
for ( i = 0 ; i < ARRAYSZ ; i++ )
     {
     EXEC SQL FETCH cust_cursor INTO :cust_name[i] ) ;
     if (sqlca.sqlcode) break ;
     printf ("Customer name is %s \n", cust_name.tpe_array[i]) ;
     } 

EXAMPLE

This example illustrates an array variable in the INTO clause of a FETCH statement:

EXEC SQL BEGIN DECLARE SECTION ;
cust_name_t IS AN ARRAY OF char WITH SIZE 20 ;
cust_name   IS AN ARRAY of cust_name_t WITH SIZE 10 ;
EXEC SQL END DECLARE SECTION ;
   .
   .
   .
EXEC SQL FETCH cust_cursor INTO :cust_name ; 

EXAMPLE

This example illustrates how to define an array variable to be used by a FETCH statement

EXEC SQL BEGIN DECLARE SECTION ;
TYPE customer_array_type IS AN ARRAY OF customer_record WITH SIZE 50 ;
EXEC SQL END DECLARE SECTION ;
   .
   .
   . 

ENVIRONMENT

Embedded SQL-92 only


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095