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 Where Current Of

In Oracle, if you wish to update or delete records that have been referenced by a SELECT FOR UPDATE statement, you can use the WHERE CURRENT OF statement. The where current of statement allows you to update or delete the record that was last fetched by the cursor.

Oracle Where Current Of Syntax

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


UPDATE table_name
  SET set_clause
  WHERE CURRENT OF cursor_name;


table_name: The table name.

set_clause: To populate the cursor result set.

cursor_name: The cursor name.

Oracle Where Current Of example

The following Oracle example shows how to use the WHERE CURRENT OF statement:


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

   CURSOR cur1
     SELECT address
     FROM tblCustomerLoan
     WHERE firstName = cust_name
	 FOR UPDATE of cellNo;


   OPEN cur1;
   FETCH cur1 INTO adder;
    if cur1%notfound then
      adder := 'Not found';

      UPDATE tblCustomerLoan
        SET cellNo = '8464545454'
        WHERE CURRENT OF cur1;


   end if;
   CLOSE cur1;

RETURN adder;


In the above example, shows how to use the WHERE CURRENT OF statement.