Oracle SQL — Merge into example
Merge is a good technique to updating values quickly . If you want to update values in a big table from a table(with only columns meant for update) , you may write the code like below….
PS -> If you have indexes created on the columns of match , the merge update will be faster.
Now the code is ….
Merge /*+ PARALLEL */ into <schema>.<table> t1 using
(select col1 , col2 from <schema>.<table> ) t2 on t1.<join column > = t2.<join column>
when matched then update set t1.column1 = t2.column1
where t1.xxx = ‘Y’ //optional
Ofcoure the above one is a variant of MERGE , there are many ways …but this is one of the way…