Updated on 2024-06-03 GMT+08:00

OPEN

Description

Opens a cursor and optionally binds actual values to placeholders in the cursor declaration. The cursor must have been declared using the DECLARE command. Executing the OPEN command triggers the query on the server.

Syntax

OPEN cursor_name
OPEN cursor_name USING value [, ... ] 
OPEN cursor_name USING SQL DESCRIPTOR descriptor_name

Parameters

  • cursor_name

    Name of the cursor to be opened. It can be an SQL identifier or a host variable.

  • value

    A value that is to be bound to a placeholder in the cursor declaration. It can be an SQL constant, a host variable, or a host variable with an indicator.

  • descriptor_name

    Name of the descriptor that contains the value to be bound to the placeholder in the cursor declaration. It can be an SQL identifier or a host variable.

Example

EXEC SQL OPEN a; 
EXEC SQL OPEN d USING 1, 'test'; 
EXEC SQL OPEN c1 USING SQL DESCRIPTOR mydesc; 
EXEC SQL OPEN :curname1;

Helpful Links

DECLARE