CodeSnip: How to Implement Merge Facility Using Local Variables?
page 1 of 4
Published: 10 Mar 2008
This code snippet explains how to insert and update records of a table using merge in Oracle through local variables instead of selecting records from another table. Deepankar examines the concept with the help of relevant code listings followed by a detailed analysis supported by screenshots.
by Deepankar Sarangi
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 20205/ 51


This code snippet explains how to apply the merge utility available in Oracle. Merge proves to be a suitable option where both insert and update are needed simultaneously. It can insert records into a table while simultaneously updating the previous records. But the normal operation allows the record to be peeked up either from table, view or sub query.

But there exist situations where we may require to manipulate the records before merging into destination table peeked up from the data sources (table/view/sub_query). The obvious solution seems to be the use of local variables where picked records can be stored for required manipulation. Then the merge can be slightly modified to select the manipulated records through the local variables from dual instead of original table/view/sub_query.

But the major problem arises here, which makes the following discussion vital.

View Entire Article

User Comments

No comments posted yet.

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-06-24 9:09:38 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search