ALLBASE/SQL Reference Manual (36216-90216)

432 Chapter11
SQL Statements E - R
GENPLAN
NOTE
It is your responsibility to ensure that for each simulated host variable
defined in the GENPLAN statement WITH clause, you use the SQL data type
shown in the tables. If you use an incorrect data type, GENPLAN will
generate a plan. However, it may not be the plan the optimizer will choose
when your application is preprocessed.
For each individual session, SYSTEM.PLAN stores the result of only one GENPLAN at a
time. If GENPLAN is issued twice in succession, the second plan will replace the first. The
access plan generated by GENPLAN is removed from SYSTEM.PLAN as soon as a
COMMIT WORK or ROLLBACK WORK statement is issued.
GENPLAN can be applied to a type II insert query.
The active SETOPT will be used for the statement of GENPLAN on an
SQLStatement
only. A currently active SETOPT is ignored if a GENPLAN statement is executed on a
section.
You can find the section number from the source file produced by the preprocessor after
the application is processed.
Use the following information to find the section number for a procedure statement:
A section exists for each SQL statement in a procedure except:
BEGIN WORK
ROLLBACK WORK
SAVEPOINT
OPEN cursor
CLOSE cursor
Procedure sections are numbered consecutively, starting with 1, from the start of the
Table 11-4. GENPLAN WITH Clause Data Types — C
C Host Variable Data Type Declaration GENPLAN WITH Clause SQL Data Type
char
dataname
; CHAR
char
dataname
[n+1]; VARCHAR(n)
short
dataname
; SMALLINT
short int
dataname
; SMALLINT
int
dataname
; INTEGER
long int
dataname
; INTEGER
long
dataname
; INTEGER
float
dataname
; REAL
double
dataname
; FLOAT