Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Merge By ROWID, Implications

308525Sep 8 2011 — edited Sep 13 2011
Hi,

could someone give me a run down of the implications of MERGE by ROWID in such a fashion:


MERGE
INTO XXWT_AP_ACCRUALS_RECEIPT_F EXT
USING (
SELECT PO_DISTRIBUTION_ID,
ROWID AS ARR_ROWID,
FUNC_ACCRUAL_AMOUNT * ((QUANTITY_RECEIVED_ATOMIC - QUANTITY_BILLED_ATOMIC)
/ SUM( QUANTITY_RECEIVED_ATOMIC-QUANTITY_BILLED_ATOMIC) OVER (PARTITION BY PO_DISTRIBUTION_ID) ) AS ACCRUAL_AMOUNT_ATOMIC
FROM XXWT_AP_ACCRUALS_RECEIPT_F AAR
WHERE PO_DISTRIBUTION_ID IS NOT NULL
AND PERIOD_KEY = LN_PERIOD_KEY
AND SEGMENT1_LEGAL_ENTITY = LV_COMPANY
AND NVL(QUANTITY_ACCRUED,0) !=0
) SUB
ON (
EXT.ROWID = SUB.ARR_ROWID
)
WHEN MATCHED THEN
UPDATE SET EXT.ACCRUAL_AMOUNT_ATOMIC = SUB.ACCRUAL_AMOUNT_ATOMIC




Can this lead to an "Unstable Set of Rows?". Is it possible for the ROWID's to change during the execution of this statement - meaning certain ROWIDs identified in the SELECT will not actually be updated when it comes to the MERGE operation?

Basically, is it sound practice to use ROWID to merge on - in cases where you dont have a WHEN NOT MATCHED condition?

Thanks in advance for any input......
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 11 2011
Added on Sep 8 2011
13 comments
9,404 views