There is a table CITY. CREATE TABLE CITY ( ID INTEGER NOT NULL, Name NVARCHAR2(5
ID: 3853107 • Letter: T
Question
There is a table CITY.
CREATE TABLE CITY (
ID INTEGER NOT NULL,
Name NVARCHAR2(50) NOT NULL ,
CountryCode CHAR(3) NOT NULL ,
District NVARCHAR2(50) NOT NULL ,
Population INTEGER NOT NULL,
PRIMARY KEY (ID)
);
1-Suppose that a transaction wants to lock the city table using the row share table lock.
Show the SQL LOCK statement
Can other transaction get a row share table lock on the same table?
2-Suppose that a transaction want to lock the city table using the share row exclusive table lock.
Show the SQL LOCK statement
Can other transaction get a share table lock on the same table?
3-Suppose that a transaction does this SQL in Oracle DBMS.
SELECT population FROM city FOR UPDATE;
Will Oracle provide any locking?
If your answer is yes for part a, what kind of locking is provided?
Explanation / Answer
1) LOCK TABLE CITY IN ROW SHARE MODE
Yes,Other transaction can get a table row share mode lock on the city table.
2) LOCK TABLE CITY IN ROW EXCLUSIVE MODE
Yes,Other transaction can get a table row share mode lock and row exclusive locks on the city table.
3)Yes,Oracle will provide ROW EXCLUSIVE Lock.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.