Progress
Embedded SQL-92
Guide and Reference
Using Host Variables
You must declare host variables in the DECLARE SECTION before you can use them in an ESQL executable statement. The data types used to declare host variables generally must be the same types as database types. For example, to declare a host variable of C Language type SHORT, the precompiler allows you to DECLARE the variable as database type SMALLINT.
This is the general format for declaring host variables in the DECLARE SECTION:
host variable
NOTE: When you use a host variable in an ESQL executable statement, you must prepend a colon ( : ) to the variable.EXAMPLEThe following code fragment shows the use of host variables in an embedded SQL program:
The following list provides a summary of how and when to use host variables:
- Explicitly DECLARE host variables in the DECLARE SECTION.
- Prepend host variables with a colon ( : ) when you use them in an ESQL statement.
- Do not prepend host variables with a colon in the DECLARE SECTION or when you use them in a C Language statement.
- Name a host variable with a name that is not an SQL reserved word.
- Use a host variable in an ESQL statement only where a constant is valid.
- You can associate an indicator variable with a host variable.
Copyright © 2004 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |