Sample host-variable declarations
The following figure shows an example of how to use the
EXEC SQL syntax to declare host variables.
Figure 1. Declaring host variables with
the EXEC SQL syntax
EXEC SQL BEGIN DECLARE SECTION;
char *hostvar; /* pointer to a character */
int hostint; /* integer */
double hostdbl; /* double */
char hostarr[80]; /* character array */
struct {
int svar1;
int svar2;
⋮
} hoststruct; /* structure */
EXEC SQL END DECLARE SECTION;
The following figure shows an example of how to use the
dollar sign ($) notation to declare host variables.
Figure 2. Declaring host variables with
the dollar sign ($) notation
$char *hostvar;
$int hostint;
$double hostdbl;
$char hostarr[80];
$struct {
int svar1;
int svar2;
⋮
} hoststruct;