SQL/MX 2.x Reference Manual (G06.24+, H06.03+)
Embedded-Only SQL/MX Statements
HP NonStop SQL/MX Reference Manual—523725-004
3-11
CLOSE Statement
CLOSE Statement
Considerations for CLOSE
C Examples of CLOSE
COBOL Examples of CLOSE
The CLOSE statement closes a cursor in a host program and releases the result table 
established by the OPEN statement for the cursor. The COMMIT WORK statement or 
ROLLBACK WORK statement also closes all open cursors in a host program and 
releases all result tables.
In dynamic SQL, the cursor name is provided at execution time. Otherwise, there is no 
difference in the static and dynamic forms of CLOSE.
Use CLOSE only in embedded SQL programs in C or COBOL. 
cursor-name
is an SQL identifier—the name of an open cursor. See Identifiers on page 6-54.
GLOBAL | LOCAL
specifies scope. The default setting is LOCAL. The scope of a GLOBAL cursor is 
the SQL session. The scope of a LOCAL cursor is the module or compilation unit 
in which CLOSE appears.
ext-cursor-name
is a value-specification—a character literal or a host variable with character 
data type. When CLOSE executes, the content of the value specification (if a host 
variable) gives the name of the cursor.
Considerations for CLOSE
Scope of CLOSE
The module or compilation unit that contains the CLOSE statement also has a 
DECLARE CURSOR statement that uses the same cursor name. The cursor name in 
the CLOSE statement is associated with the cursor specification in this DECLARE 
CURSOR.
CLOSE {cursor-name | ext-cursor-name}
ext-cursor-name is:
 [GLOBAL | LOCAL] value-specification 
C/COBOL










