how can we implement locks in plsql?



how can we implement locks in plsql?..

Answer / Chandra Dev Pankaj

In PL/SQL, you can implement database locks to prevent concurrent access and modifications to shared data. This is typically done using the DBMS_LOCK package. Here's an example of how to acquire a row lock for a specific record in a table:

BEGIN
dbms_lock.request(type => dbms_lock.row_lock, name => 'MY_LOCK', mode => dbms_lock.exclusive);
SELECT * FROM MY_TABLE WHERE ROWID = :myRowId FOR UPDATE; -- modify the data here
COMMIT;
dbms_lock.release(name => 'MY_LOCK');
END;

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Programming Languages AllOther Interview Questions

code for connection from windows forms to sql server

1 Answers   ME,


What binary value will be internally stored for NULL for the type S9(1) COMP 3 in mainframe

1 Answers  


What is good attributes of Programming language ?

6 Answers   GKN Land Systems,


what are the advantages of sap on other software ?

1 Answers  


Building Quotation engine program

5 Answers   Wipro,


how to study PHP my own? i reffered many sites.. but as being a fresher i couldnt follow those... which site will be the best one?

1 Answers  


you have an unlimited supply of $3 and $7 poker chips. What is the largest integer value that you cannot make by combining different numbers of chips?

2 Answers  


Artficial language is provided which of the language?

3 Answers   Geometric Software,


is try block possible without catch block?

3 Answers  


what are the activities you enjoy most and How do you see these Developing in the Future with Reference to in your work life and in your personal life

1 Answers  


I have try to write a record in a TDQ from a fle.... what are the steps to do... can anybody plz come with a solution

1 Answers  


which book we learned this mantis? how many version are realsed this mantis upto now?

1 Answers  


Categories