摘要 |
Conditional functionality is provided for database merge operations. A merge operation, for merging data from a source to a destination, involves performing a default operation for each source record. Default operations associated with a MERGE statement include UPDATE and INSERT operations. Which default operation is performed depends on whether any destination record corresponds to a given source record. In an embodiment, whether a specified condition is satisfied is determined. If the condition is satisfied, then the default operation that is appropriate for a given source record is performed. If the condition is not satisfied, then the given source record is processed without performing the appropriate default operation. In one aspect, the UPDATE clause of the MERGE statement is extended to include a conditional DELETE clause. Hence, records are deleted as appropriate based on a temporary updated state, as part of the same process as the update operation, without an additional table scan and without having to first update the record in shared memory or in persistent storage.
|