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 Fetch Cursor

In Oracle, You can use the FETCH statement to retrieve rows from your cursor. After declaring and opening the cursor, the next step is to use the FETCH statement to fetch rows from your cursor.

Oracle Fetch Cursor Syntax

To retrieve the rows from declared cursor in Oracle, use the following syntax:


FETCH cursor_name INTO variable_list;


cursor_name: The name of cursor.

variable_list: List of comma delimited variables to store the cursor result set.

Oracle Fetch Cursor example

The following Oracle example shows how to retrieve rows from cursor:


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

   CURSOR cur1
     SELECT address
     FROM tblCustomerLoan
     WHERE firstName = cust_name;


   OPEN cur1;
   FETCH cur1 INTO adder;
   CLOSE cur1;

RETURN adder;


In the above example, shows how to use the Fetch statement to retrieve rows from cursor.