Oracle Tutorial

What is Oracle
SQL Keywords

Oracle Wildcards

Oracle Wildcards

Oracle Aliases

Oracle Aliases

MySQL Tutorial

MySQL Tutorial

PL/SQL Tutorial

PL/SQL Tutorial

Oracle Interview Questions

Oracle Interview Questions and Answers


Oracle Close Cursor

In Oracle, once you have finished using cursor, the next step is to close the declared cursor. You can use the CLOSE statement to close the cursor.

Oracle Close Cursor Syntax

To close a declared cursor in Oracle, use the following syntax:

Syntax

CLOSE cursor_name;

Parameters:

cursor_name: The name of cursor.

Oracle Close Cursor example

The following Oracle example shows how to close cursor:

Example

CREATE OR REPLACE Function SearchCustomer
  ( cust_name IN varchar2 )
  RETURN varchar2
IS
   adder varchar2;

   CURSOR cur1
   IS
     SELECT address
     FROM tblCustomerLoan
     WHERE firstName = cust_name;

BEGIN

   OPEN cur1;
   FETCH cur1 INTO adder;
   CLOSE cur1;

RETURN adder;

END;

Note:

In the above example, shows how to use the Close statement to open cursor.