Database Reference
In-Depth Information
The MERGE command enables a combination insert and update to a table
using a single DML command.
15.6
Merging New and Old Data (MERGE)
There are some enhancements to the MERGE command between Oracle
Database 9 i and Oracle Database 10 g . The purpose of the MERGE com-
mand is to allow you to build on an already existing table's rows. For exam-
ple, you have a central database that tracks contact information for clients.
Your salespeople have handheld palmtop units that they use to record con-
tact information for new and existing clients. The palmtop's client table has
only half the data for existing customers, because that is all the salespeople
need in the field. When salespeople return to the central office, they plug in
their palmtops and dump the data about all their clients. The central com-
puter must determine whether the client is new or already existing in the
central database client table. Then, if it is new, a row is inserted. If it already
exists, the existing row is updated, preserving the data in columns that are
not provided in the palmtop record.
In the past, a merging or migration process would have required an
application program, perhaps even custom coding and scripting. Now, you
can use the MERGE command to handle these issues. Figure 15.16 shows
Figure 15.16
Merge Looks
Complex but Has
Familiar
Components.
Search WWH ::




Custom Search