The CLOSE statement closes a cursor. If a result table was created when the cursor was opened, that table is destroyed.
This statement can only be embedded in an application program. It is an executable statement that cannot be dynamically prepared. It must not be specified in Java™.
None required. See DECLARE CURSOR for the authorization required to use a cursor.
>>-CLOSE--cursor-name------------------------------------------><
Implicit cursor close: All cursors in a program are in the closed state when:
Close cursors for performance: Explicitly closing cursors as soon as possible can improve performance.
Procedure considerations: Special rules apply to cursors within procedures that have not been closed before returning to the calling program. For more information, see CALL.
In a COBOL program, use the cursor C1 to fetch the values from the first four columns of the EMPPROJACT table a row at a time and put them in the following host variables:
Finally, close the cursor.
EXEC SQL BEGIN DECLARE SECTION END-EXEC. 77 EMP PIC X(6). 77 PRJ PIC X(6). 77 ACT PIC S9(4) BINARY. 77 TIM PIC S9(3)V9(2) PACKED-DECIMAL. EXEC SQL END DECLARE SECTION END-EXEC. . . . EXEC SQL DECLARE C1 CURSOR FOR SELECT EMPNO, PROJNO, ACTNO, EMPTIME FROM EMPPROJACT END-EXEC. EXEC SQL OPEN C1 END-EXEC. EXEC SQL FETCH C1 INTO :EMP, :PRJ, :ACT, :TIM END-EXEC. IF SQLSTATE = '02000' PERFORM DATA-NOT-FOUND ELSE PERFORM GET-REST-OF-ACTIVITY UNTIL SQLSTATE IS NOT EQUAL TO '00000'. EXEC SQL CLOSE C1 END-EXEC. GET-REST-OF-ACTIVITY EXEC SQL FETCH C1 INTO :EMP, :PRJ, :ACT, :TIM END-EXEC. . . .