Oracle Open Cursor
In Oracle, the next step is to open declared cursor. You can use the OPEN statement to open the cursor.
Oracle Open Cursor Syntax
To open a declared cursor in Oracle, use the following syntax:
Parameters:
cursor_name: The name of cursor.
Oracle Open example
The following Oracle example shows how to open 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 OPEN statement to open cursor.