Skip to content

CLOSE

DECLARE
emp_cursor CURSOR FOR
SELECT * FROM employees;
BEGIN
OPEN emp_cursor;
CLOSE emp_cursor;
END;

This script won’t generate a visible output, because the cursors don’t produce visible outputs in Oracle database.

In the Example, a cursor emp_cursor is declared, which fetches all records from the employees table. The OPEN statement opens the cursor, making it ready to fetch the data. The CLOSE statement, which is the focus of this example, is used to close the cursor emp_cursor after the usage. Since a closed cursor cannot be referenced, the CLOSE statement is essential to free up the memory in the database environment.