In the update optimization, considering the efficiency of the update from is relatively high, but because Oracle will check the key value, resulting in a ora-01779 error, by using BYPASS_UJVC to skip the Oracle key determination, achieve the same effect.
Example:
Update (select/* + BYPASS_UJVC */
T1.drawref,
T. oprtype,
T. bl_validation,
'F' bl_validation_new,
T. bl_msg,
T. bl_msg |
Case when (t1.drawref is null and t. oprtype = 'U') then' the transaction account number does not exist and cannot be updated ;'
When (t1.drawref is null and t. oprtype = 'D') then' the transaction account number does not exist and cannot be deleted ;'
When (t1.drawref is not null and t. oprtype = 'I') then' the transaction account number already exists and cannot be inserted ;'
End bl_msg_new
From s_bl2_con_pro_temp t
Left join s_bl2_con_pro t1
On t. drawref = t1.drawref
Where
-- T. bl_user = 134
(T. OPRTYPE <> 'n' OR t. OPRTYPE is null)
And t1.BL _ DELETED (+) = 'F'
And t1.OPRTYPE (+) in ('U', 'D', 'I ')
And t1.partition _ key (+) = '000000'
And t. partition_key = '20140901'
)
Set bl_validation = bl_validation_new,
Bl_msg = bl_msg_new
;
Commit;
The details are as follows:
When we are sure that the current condition can determine that the record is unique, and it is not the primary key, we can use two methods for processing.
1. Create a unique index
2. update (select/* + BYPASS_UJVC */a. cola va, B. colb vb from a, B where a. id = B. id) set va = vb
BYPASS_UJVC is used to determine whether to skip the Oracle key.