Updating two different tables with cursor oracle

Rated 4.6/5 based on 998 customer reviews

( Note:- Only 3 departments has employees, so total 6 employees shown in the output ) When writing nested cursor make sure 1. Summary: in this tutorial, you will learn about PL/SQL cursor and its usage.Multiple record and multiple column – Same table declare v_emprec emp%rowtype; Cursor Cur_ename is select * from emp; begin Open Cur_ename; loop Fetch Cur_ename into v_emprec; exit when Cur_ename%notfound; dbms_output.put_line(‘Name –7700 Here we are fetching all columns from EMP table and storing in cursor variable v_emprec.

After a TCL operation is performed, the cursor pointer gets reset and the cursor will be no longer accessible, thus results in an error when fetched further as shown below.

We will explain different types of Cursors with simple examples.

Previous post we have explained detailed about different types of cursors.

When we want to update or delete the cursor fetched row(s) from the database, we don’t have to form In the below code listing, the employees joined before the year 2000 are archived and during the cursor process, no other session is permitted to make any changes to those employees using the FOR UPDATE clause.

The employee deletion from the transaction table is performed using the WHERE CURRENT OF clause as shown below.

Leave a Reply