RDB/VMS SQL PREPARE — VMS RDB_4.0
PREPARE ─┬─> statement-name ─┬─┬──────────────────────────────────────┬─┐ └─> parameter ──────┘ └─> typebox (S)typebox (E)typebox (L)typebox (E)typebox (C)typebox (T) typebox (L)typebox (I)typebox (S)typebox (T)
I
N
T
O descriptor-name ──┘ │ ┌──────────────────────────────────────────────────────────────┘ └─>
F
R
O
M ──┬─> statement-string ─┬─> typebox (;) └─> parameter ────────┘
Additional information available:
More Informationstatement nameparameter
More Information
The PREPARE statement checks an SQL statement dynamically generated by a program for errors and assigns a name to that statement. With the optional INTO clause, the PREPARE statement also writes information about any output parameters in a prepared SELECT statement to the SQLDA. PREPARE is a dynamic SQL statement and can be used only in precompiled programs or as part of SQL module language procedures. It cannot be used in interactive SQL.
statement name
The name you want to assign to the prepared version of the SQL statement specified in the FROM clause. Depending on the type of SQL statement prepared, DESCRIBE, EXECUTE, and DECLARE CURSOR statements can refer to the statement name assigned in a PREPARE statement.
parameter
You can use an integer parameter instead of coding the statement name. Specifying a parameter lets SQL supply identifiers to run programs at run time. A single set of dynamic SQL statements (PREPARE, DESCRIBE, EXECUTE, Extended Dynamic DECLARE CURSOR) can handle any number of dynamically executed statements. Should you decide to use parameters, statements that refer to the prepared statement (DESCRIBE, EXECUTE, Extended Dynamic DECLARE CURSOR) must also use a parameter instead of the explicit statement name.
INTO
Specifies that SQL writes information about the number and data type of output parameters in the statement string to the SQLDA. The SELECT LIST keyword clarifies the effect of the INTO clause and is entirely optional. Using the SELECT LIST INTO clause in a PREPARE statement is an alternative to issuing a separate DESCRIBE...SELECT LIST statement. The descriptor name specifies a structure declared in the host language program as an SQLDA to which SQL writes output parameter information. If the program uses the embedded SQL statement INCLUDE SQLDA, the name of the structure is simply SQLDA. Programs can use multiple SQLDAs but must explicitly declare them with names other than SQLDA.
FROM
Specifies the SQL statement to be prepared for dynamic execution. You either specify the statement string directly in a character string literal enclosed in single quotation marks, or in a parameter that contains the statement string.