Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


What WHERE CURRENT OF clause does in a cursor?

Answers were Sorted based on User's Feedback



What WHERE CURRENT OF clause does in a cursor?..

Answer / tvgiriprasad

If you want to UPDATE or DELETE record from table by using cursor which is defined from same table,"WHERE CURRENT OF" clause can be used. We have to create cursor with "FOR UPDATE" clause to use above clause.

The most recent record fetched from the table (by looping of cursor records) should be updated or deleted by using "WHERE CURRENT OF". When a cursor open with FOR UPDATE clause ,cursor's active set will have row level Exclusive Lock. Other sessions can query the table records, and not able to delete/update or SELECT with FOR UPDATE clause.


Example: Want to update value for GRADE column to '1' for the student who has Id = '1'.

Declare
cursor C1 is
select st_id, grade,st_last_name from student where st_id = 3;
for update of grade;
[ variable declaration ……] ;
begin
open C1;
fetch C1 into v_id,v_grade,v_name;
if C1%notfound then
dbms_output.put_line (‘No Record is found.’);
else
update student set grade=1 WHERE CURRENT OF;
COMMIT;
END IF;

CLOSE C1;
end;

Is This Answer Correct ?    1 Yes 0 No

What WHERE CURRENT OF clause does in a cursor?..

Answer / kamala k n

return latest fetch row to perform DML on it it is unique

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Oracle General Interview Questions

What is rowid and rownum in oracle?

0 Answers  


How do I call oracle stored procedures that take no parameters?

0 Answers  


What suggestions do you have to reduce the network traffic?

0 Answers  


I just want to maintain data like an employee can belongs to 3 or more departments . We can resolve this by using composite key but it avoids normalization rules. So Can anyone tell me how can I maintain data.

0 Answers   IBM,


what is a cartition product?

4 Answers  


How to empty your oracle recycle bin?

0 Answers  


What is the Difference between 1) ER MODEL and Relational Model 2) Dense Index and Sparse Index

1 Answers  


ABOUT IDENTITY?

0 Answers   HCL,


find out the third highest salary?

92 Answers   CIPL, Cyber Shot, HCL, Hewitt, IBM, JPMorgan Chase, Orion, Verizon,


what is the output of select * from emp where null=null & select * from emp where 1=1

8 Answers   IMS Health, NIIT,


what are stored procedures?

7 Answers   TCS, Wells Fargo,


what are indexes..how many types of index's are there and what are they?

7 Answers   Green Info Solutions, TCS,


Categories
  • Oracle General Interview Questions Oracle General (1809)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)