MERGE INTO Issue

Database
Enthusiast

MERGE INTO Issue

Hi everyone,

i have an issue regarding the MERGE INTO statement.
Let say that i have this statement for example:
explain MERGE INTO DB_A.TABLE_A
using
(
SELECT
Field_01
, Field_02
, Field_03
, count(*) as Field_04
FROM DB_A.TABLE_B
group by Field_01, Field_02, Field_03
)
as v
( m_Field_01
, m_Field_02
, m_Field_03
, m_Field_04
) on
Field_01 = v.m_Field_01
and Field_02 = v.m_Field_02
and Field_03 = v.m_Field_3
when matched then update set
Field_04 = Field_04 + v.m_Field_04
when not matched then
insert values
( v.m_Field_01
, v.m_Field_02
, v.m_Field_03
, v.m_Field_04
) logging errors with no limit;

and it said that it will:
- we lock DB_01.ET_TABLE_01 for write
- we lock DB_01.TABLE_01 for write <<<
- we lock DB_01.TABLE_02 for read

my question is:
when it said lock for write is it mean lock for read and write also?

thanks
1 REPLY
Enthusiast

Re: MERGE INTO Issue

Yes, a write lock prevents other transactions from getting either a read lock or a write lock on the object.