Host variables can be used in the following circumstances:
The ISO/ANSI standard allows an embedded SQL source file to declare the following special host variables within a declaration section:
long SQLCODE; char SQLSTATE[6]; |
If used, these variables are set after any embedded SQL statement that makes a database request (EXEC SQL statements other than DECLARE SECTION, INCLUDE, WHENEVER SQLCODE, and so on).
The SQLCODE and SQLSTATE host variables must be visible in the scope of every embedded SQL statement that generates database requests.
For more information, see the description of the sqlpp -k option in SQL preprocessor.
The following is valid embedded SQL:
EXEC SQL INCLUDE SQLCA; EXEC SQL BEGIN DECLARE SECTION; long SQLCODE; EXEC SQL END DECLARE SECTION; sub1() { EXEC SQL BEGIN DECLARE SECTION; char SQLSTATE[6]; EXEC SQL END DECLARE SECTION; exec SQL CREATE TABLE ... } |
The following is not valid embedded SQL:
EXEC SQL INCLUDE SQLCA; sub1() { EXEC SQL BEGIN DECLARE SECTION; char SQLSTATE[6]; EXEC SQL END DECLARE SECTION; exec SQL CREATE TABLE... } sub2() { exec SQL DROP TABLE... // No SQLSTATE in scope of this statement } |
Send feedback about this page via email or DocCommentXchange | Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0 |