ALLBASE/SQL Reference Manual (36216-90216)

Chapter 11 467
SQL Statements E - R
PREPARE
See related ALLBASE/SQL statements in this manual and the
appropriate ALLBASE/SQL application programming guide for details of
these programming methods.
[
Owner
.]
ModuleName
[(
SectionNumber
)] This option of the PREPARE statement is
used interactively; it cannot be used in an application program.
This option specifies an identifier to be assigned to the statement being
preprocessed. Later, the identifier can be specified in an EXECUTE
statement to execute the dynamically preprocessed statement.
The section number is an integer to be used in identifying the dynamically
preprocessed statement. You can group several related sections under the
same module name by giving each one a different section number. You can
specify any section number from 1 to 32767. If you do not specify a section
number, section number 1 is assumed.
You must not already have a dynamically preprocessed statement with the
same module name and section number. You must not already have a
preprocessed application program with the specified module name.
You can specify an owner name if you have DBA authority. Non-DBA users
can specify the name of any group of which they are a member. Otherwise,
ALLBASE/SQL assigns your login name as the owner name of the module.
You cannot interactively prepare a SELECT statement.
DBEFileSetName
identifies the DBEFileSet used to store the dynamically prepared
statement. If not specified, the default SECTIONSPACE DBEFileSet is
used. (Refer to syntax for the SET DEFAULT DBEFILESET statement.)
String
is the statement to be preprocessed. The preprocessor cannot process more
than 32,762 characters. If the string contains embedded strings, delimit
the embedded strings with double single quotation marks as follows:
PREPARE MyStatement FROM 'DELETE FROM PurchDB.Parts
WHERE PartNumber = ''1123-P-01'''
HostVariable
specifies a host variable having as its value a character string which is
the statement to be preprocessed. The preprocessor cannot process more
than 32,762 characters. However, the length of a string contained in a host
variable is limited by the defined length of the host variable.