Skip to content Skip to sidebar Skip to footer

Plsql: Get Number Of Records Updated Vs Inserted When A Merge Statement Is Used

Merge will always give you the number of records merged regardless of how my records inserted or updated using SQL%ROWCOUNT. But how to find out number of records that were actuall

Solution 1:

You cannot, in general, differentiate how a row affected by a MERGE statement was affected in order to get separate counts for inserted, updated, and deleted rows.

If you really need separate figures, you could issue separate INSERT and UPDATE statements though that is likely to be less efficient. There are non-general solutions that depend on particular query plans but those are going to be rather brittle and generally wouldn't be recommended.

Post a Comment for "Plsql: Get Number Of Records Updated Vs Inserted When A Merge Statement Is Used"