ALLBASE/SQL Reference Manual (36216-90216)

464 Chapter11
SQL Statements E - R
OPEN
OPEN
The OPEN statement is used in an application program or a procedure to open a cursor, that
is, make the cursor and its associated active set available to manipulate a query result.
Scope
Application Programs and Procedures Only
SQL Syntax
OPEN
CursorName
[KEEP CURSOR [WITH LOCKS
WITH NOLOCKS]]
[USING { [SQL]DESCRIPTOR {SQLDA
AreaName
}
HostVariableName
[[INDICATOR]:
IndicatorVariable
][,...]} ]
Parameters
CursorName
specifies the cursor to be opened. The cursor name must first be defined
with a DECLARE CURSOR statement.
KEEP CURSOR maintains the cursor position across transactions until a CLOSE statement
is issued on the cursor.
This clause is not available for procedure cursors (those declared for an
EXECUTE PROCEDURE statement).
WITH LOCKS keeps only those locks associated with the position of the kept cursor after
a COMMIT WORK statement, and releases all other locks. This is the
default.
WITH NOLOCKS releases all locks associated with the kept cursor after a COMMIT WORK
statement.
USING allows dynamic parameter substitution in a prepared statement.
This clause can only be specified within an application when opening a
cursor on a dynamically prepared SELECT or EXECUTE PROCEDURE
statement.
SQL DESCRIPTOR specifies a location that at run time contains the data value assigned to
an input dynamic parameter specified in a prepared SELECT or EXECUTE
PROCEDURE statement.
Specify the same location (SQLDA or
AreaName
) as you specified in the
DESCRIBE INPUT statement.
SQLDA specifies that a data structure of sqlda_type named sqlda is used to pass
dynamic parameter data between the application and ALLBASE/SQL.
AreaName
specifies the user defined name of a data structure of type sqlda_type that
is used to pass dynamic parameter data between the application and
ALLBASE/SQL.