Types of cursor locks and explanation each of them ?

Answer Posted / kalyan dhara

FOR UPDATE and CURRENT OF
---------------
When you issue a SELECT...FOR UPDATE statement, the RDBMS
automatically obtains exclusive row-level locks on all the
rows identified by the SELECT statement, holding the records
“for your changes only” as you move through the rows
retrieved by the cursor. No one else will be able to change
any of these records until you perform a ROLLBACK or a COMMIT.

CURSOR toys_cur IS
SELECT name, manufacturer, preference_level,
sell_at_yardsale_flag
FROM my_sons_collection
WHERE hours_used = 0
FOR UPDATE;

UPDATE table_name
SET set_clause
WHERE CURRENT OF toys_cur ;

OR

DELETE FROM table_name
WHERE CURRENT OF toys_cur ;

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the current version of sql?

540


Is sql sequential or random?

541


How exception is different from error?

545


Is a table valued function object?

583


How is pl sql different from sql?

548






Suppose a student column has two columns, name and marks. How to get name and marks of the top three students.

531


What is primary key and foreign key?

534


What found sql?

529


What is a primary key sql?

565


how can we repair a mysql table? : Sql dba

540


What is the difference between union and union all command?

555


what is commit? : Sql dba

619


Explain some predefined exceptions.

589


What is the difference between microsoft access and sql server?

533


what is the difference between union and union all? : Sql dba

548