SQL_CLOSE_CURSOR_STMT¶
Applies to: ORAFlex SQLFlex MYSQLFlex PGFlex DB2Flex
This command closes the specified cursor that was created from SQL_OPEN_CURSOR_STMT. It is good practice to close all cursors once the statements associated with them are complete.
Syntax
SQL_CLOSE_CURSOR_STMT [of {server}] to {variable}
Parameter |
Description |
---|---|
server |
Name of the server (optional) |
variable |
Cursor handle to close |
Example
SQL_OPEN_CURSOR_STMT to hCursor1
SQL_SET_STMT to "SELECT * FROM CUSTOMER WHERE STATUS = 'Active' "
SQL_PREPARE_STMT
SQL_EXECUTE_STMT
SQL_OPEN_CURSOR_STMT to hCursor2
SQL_SET_STMT to "SELECT * FROM CUSTOMER WHERE STATUS = 'Inactive' "
SQL_PREPARE_STMT
SQL_EXECUTE_STMT
Repeat
SQL_SET_CURRENT_CURSOR_STMT to hCursor1
SQL_FETCH_NEXT_ROW INTO sID sFirstName sLastName
If (Found) Begin
Showln "Active : " sID "- " sFirstName sLastName
End
SQL_SET_CURRENT_CURSOR_STMT to hCursor2
SQL_FETCH_NEXT_ROW into sId sFirstName sLastName
If (Found) Begin
Showln "Inactive : " sID "- " sFirstName sLastName
End
Until (FindErr)
SQL_CLOSE_CURSOR_STMT to hCursor1
SQL_CLOSE_CURSOR_STMT to hCursor2