RDB/VMS SQL OPEN — VMS RDB_4.0
OPEN ─┬─> cursor-name ─┬─┬─────────────────>─────────────────────┬──>typebox (;) └─> parameter ───┘ ├──>
U
S
I
N
G ──┬─> parameter ─┬───────────┤ │ └────── , <────┘ │ └──>
U
S
I
N
G
D
E
S
C
R
I
P
T
O
R descriptor-name ──┘
Additional information available:
Opening lists
OPEN ─┬─> list-cursor-name ─┬─┬─────────────────>─────────────────────┬──>typebox (;) └─> parameter ───┘ ├──>
U
S
I
N
G ──┬─> parameter ─┬───────────┤ │ └────── , <────┘ │ └──>
U
S
I
N
G
D
E
S
C
R
I
P
T
O
R descriptor-name ──┘ To open a list cursor, replace the cursor-name in the OPEN statement with a list cursor-name. A list cursor is declared in a DECLARE LIST CURSOR or a dynamic DECLARE CURSOR that specifies a list cursor. For more information, see the Examples under New_features.
More Information
The OPEN statement opens a cursor so that rows of its result
table can be retrieved through FETCH statements. The OPEN
statement places the cursor before the first row of its result
table. You can use the OPEN statement in interactive SQL,
embedded in precompiled host programs, or as part of an SQL
module language procedure.
You must specify the USING clause when:
1. The declaration of the cursor you are opening specified a
prepared SELECT statement name, and
2. That prepared SELECT statement declaration includes
parameter markers
SQL does not allow the USING clause in an OPEN statement for a
cursor that is not based on a dynamic SELECT statement.
USING
SQL allows the USING clause only in dynamic SQL. It specifies parameters whose values SQL uses to replace parameter markers in a prepared SELECT statement named in the cursor declaration. SQL replaces the parameter markers with the values of the parameters when it evaluates the SELECT statement of the cursor. Select More_Information to continue.
Additional information available:
More Information
There are two ways to specify parameters in a USING clause:
o With a list of parameters. The number of parameters in the
list must be the same as the number of parameter markers in
the prepared SELECT statement.
o With the name of a descriptor that corresponds to an SQL
Descriptor Area (SQLDA). Specify the name of the descriptor
in the USING DESCRIPTOR clause. If you used the INCLUDE
statement to insert the SQLDA into your precompiled program,
the descriptor name is simply SQLDA. Programs that call SQL
module language procedures must explicitly declare an SQLDA
descriptor and can give it any name.
The data types of program parameters must be compatible with the
values of the corresponding column of the cursor row.