SQL/MP Reference Manual
HP NonStop SQL/MP Reference Manual—523352-013
P-25
PREPARE Statement
For more information about a specific predicate, see the entry for that predicate.
PREPARE Statement
PREPARE is a dynamic SQL statement and an SQLCI command that compiles an 
SQL statement for later execution with EXECUTE.
In host programs, PREPARE also returns information to the SQLSA that you can use 
to declare an SQLDA for DESCRIBE and EXECUTE statements. (For information, see 
INCLUDE SQLDA Directive on page I-4 or the SQL/MP programming manual for your 
host language.)
In SQLCI, you can use PREPARE to check syntax even if you don't intend to execute 
the statement in the session. PREPARE also returns statistics about the compilation 
time.
{ stmt-name }
{ :stmt-name-var }
specifies a name to be used for the prepared statement. If you specify the name of 
an existing prepared statement, the new statement overwrites the previous one.
stmt-name is an SQL identifier that is the name. You can use this form to specify 
the name in programs or in SQLCI. In SQLCI, the name must be unique among 
other statement and report item names in the SQLCI session.
:stmt-name-var is a host variable that contains an SQL identifier that is the 
name. You can use this form to specify the name from programs. The variable 
must be of a type compatible with SQL type CHAR or VARCHAR.
FROM { "stmt" | 'stmt' }
 { :stmt-var }
specifies the statement to prepare.
{ "stmt" | 'stmt' }
(for SQLCI only) is a DCL, DDL, DML, or DSL statement enclosed in single or 
double quotation marks.
:stmt-var
(for programs only) is a host variable of a character data type that contains an SQL 
statement. The statement:
Can use parameters as literals if it is a DML statement (see Parameters on 
page P-11)
PREPARE { stmt-name } FROM { "stmt" | 'stmt' }
 { :stmt-name-var } { :stmt-var }










