A Cursor in Oracle PLSQL is basically a memory area, in which the records or results fetched by an SQL SELECT Statement can be stored.
The last step in working with CURSOR in Oracle PLSQL is to CLOSE the CURSOR once we have finished processing the records of the CURSOR.
CLOSE CURSOR Syntax
Close Cursor Example
Let’s understand, how to CLOSE Statement a cursor from the help of the below PLSQL function
CREATE OR REPLACE FUNCTION GetSalary IS cur_sal NUMBER; CURSOR cur_salary IS SELECT salary FROM employee; BEGIN CLOSE cur_salary; FETCH cur_salary IN cur_sal; IF cur_salary%NOTFOUND THEN cur_sal := 100000; END IF; CLOSE cur_salary; END;
The statement CLOSE cur_salary; will be used to close the cursor cur_salary.
Hope you like the information on Close Cursor; please share the same with others also.