SQL/MX 2.x Reference Manual (H06.04+)

Embedded-Only SQL/MX Statements
HP NonStop SQL/MX Reference Manual540440-003
3-9
BEGIN DECLARE SECTION Declaration
BEGIN DECLARE SECTION Declaration
BEGIN DECLARE SECTION is a preprocessor directive that begins SQL declarations
in a host program. SQL declarations are used to define host variables to be used in
SQL/MX statements—for example, to transfer data to and from a database.
Use BEGIN DECLARE SECTION only in embedded SQL programs in C or COBOL.
See END DECLARE SECTION Declaration on page 3-36.
C Examples of BEGIN DECLARE SECTION
This example shows a declaration section:
EXEC SQL BEGIN DECLARE SECTION;
short length;
char data[10];
EXEC SQL END DECLARE SECTION;
This example shows a declaration section that uses an INVOKE directive to
declare a structure template of a table:
EXEC SQL BEGIN DECLARE SECTION;
EXEC SQL INVOKE SALES.PARTS;
EXEC SQL END DECLARE SECTION;
C++ Examples of BEGIN DECLARE SECTION
This example shows a declaration section within a class. Member functions using
these host variables must be defined within the visible scope of the class.
class jobsql {
// Class member host variables
EXEC SQL BEGIN DECLARE SECTION;
short length;
VARCHAR data[19];
EXEC SQL END DECLARE SECTION;
public:
...
}
}; // End of jobsql class definition
BEGIN DECLARE SECTION
C/COBOL