Thanks for the question, AKASH.
Asked: December 08, 2016 - 12:41 pm UTC
Last updated: December 08, 2016 - 3:02 pm UTC
Version: 11
Viewed 1000+ times
You Asked
Hi Tom,
I have created one table for example like
CREATE TABLE reservation
(
Reservation_Id NUMBER,
Reservation_number NUMBER
);
INSERT INTO reservation (Reservation_Id, Reservation_number) VALUES(1, 100001);
INSERT INTO reservation (Reservation_Id, Reservation_number) VALUES(2, 100002);
INSERT INTO reservation (Reservation_Id, Reservation_number) VALUES(3, 100003);
INSERT INTO reservation (Reservation_Id, Reservation_number) VALUES(4, 100004);
INSERT INTO reservation (Reservation_Id, Reservation_number) VALUES(5, 100005);
INSERT INTO reservation (Reservation_Id, Reservation_number) VALUES(6, 100006);
now opened two sessions A and B
session A> SELECT * FROM reservation WHERE reservation_id = 4 FOR UPDATE NOWAIT;
this row locked for other session B, But i want to update that locked row reservation_number column
session B> UPDATE reservation SET Reservation_number = 110004 WHERE reservation_id = 4;
so is there any way to update that locked Row reservation_number from session B ?
Thanks in advance,
and Chris said...
No. You can't change a row that another session has locked until they commit or rollback.
You need to complete the transaction in session A before B can run its update.
Rating
(1 rating)
Is this answer out of date? If it is, please let us know via a Comment