Embedded SQL for C and SQL Server
BEGIN DECLARE SECTION
The BEGIN DECLARE SECTION statement marks the beginning of a C host-variable declaration section.
Syntax
BEGIN DECLARE SECTION
Remarks
The BEGIN DECLARE SECTION statement can be included anywhere C permits declaring variables, and where declared host variables follow the normal rules for scoping in C. Use END DECLARE SECTION to identify the end of a C declaration section. The embedded BEGIN DECLARE SECTION statement must follow the EXEC SQL introductory keyword.
Declare sections cannot be nested.
Use the following rules for declaring host variables:
- Host variables must be declared in C, not in Transact-SQL.
- Host variables referenced by Embedded SQL statements must be included in a declaration section that appears before the statement.
Examples
EXEC SQL BEGIN DECLARE SECTION;
int id;
char name[30];
EXEC SQL END DECLARE SECTION;