Progress
SQL-92
Guide and Reference
BEGIN-END DECLARE SECTION
Declares variables and types used by the precompiler. Any variables you refer to in an embedded SQL-92 statement must be declared in a DECLARE SECTION. This section starts with a BEGIN DECLARE SECTION statement and ends with an END DECLARE SECTION statement. Each variable must be declared as a host language data type.
SYNTAX
host_lang_type variable_name ;
A conventional C Language variable declaration. This form of variable declaration conforms to the ANSI standard for the C Language.
EXAMPLE
This example is a code fragment from the
StatSel
function in the sample program2StatSel.pc
. The complete source for sample program,2StatSel.pc
, is listed in Appendix A of the Progress Embedded SQL-92 Guide and Reference .
NOTES
- The C Language type int is not supported by ESQLC. Type int maps to 16 or 32 bits depending on the machine architecture. This can create rounding errors at runtime as values are passed across different machine architectures.
- Variables you declare in a BEGIN-END DECLARE SECTION can be used in C Language statements as if they had been declared outside the DECLARE SECTION.
- The scope of variables follows host language scoping rules. The ESQLC variables are not visible outside the file in which they are declared.
- DECLARE sections are permissible only where host language declarations are permissible in the host language syntax. This restriction is due to how DECLARE SECTION blocks are translated into the main body of host language declarations.
- Avoid DECLARE sections in header files that are included by more than one source file. This can cause duplicate variables with the same name.
- The form of the variable created by ESQLC for each type is specified so that it can be manipulated from host language statements. Declaring variables allows you to use the variables in both host language and embedded SQL-92 statements.
AUTHORIZATION
None
SQL COMPLIANCE
Declarations that use host-language types
ENVIRONMENT
Embedded SQL-92 only
RELATED STATEMENTS
Static Array Types (Chapter 14 in the Progress Embedded SQL-92 Guide and Reference )
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |