Merge command - Delete

  • From: Robert Freeman <robertgfreeman@xxxxxxxxx>
  • To: "oracle-l@xxxxxxxxxxxxx" <oracle-l@xxxxxxxxxxxxx>
  • Date: Fri, 12 Jun 2009 09:09:54 -0700 (PDT)

So, has anyone figured out a really slick way of using the merge command to 
delete records in the target table when the record is not in the source table? 
I know there is a delete option in 10g and later, but that requires that the 
record be in the source table, with something that marks it as deleted. If the 
record is not in the source table, then that's a different condition and merge 
does not seem to handle that naturally. 

I've considered wrapping it into PL/SQL with a subsequent delete command or 
building a view with an outer join marking the missing records as missing but I 
thought someone might have figured out something slicker worth trying... :-)

RF



 Robert G. Freeman
Oracle ACE
Author:
Oracle Database 11g RMAN Backup and Recovery (Oracle Press) - ON IT'S WAY SOON!
OCP: Oracle Database 11g Administrator Certified Professional Study Guide 
(Sybex)
Oracle Database 11g New Features (Oracle Press)
Portable DBA: Oracle  (Oracle Press)
Oracle Database 10g New Features (Oracle Press)
Oracle9i RMAN Backup and Recovery (Oracle Press)
Oracle9i New Features (Oracle Press)
Other various titles out of print now...
Blog: http://robertgfreeman.blogspot.com 
The LDS Church is looking for DBA's. You do have to be a Church member in
good standing. A lot of kind people write me, concerned I may be breaking
the law by saying you have to be a Church member. It's legal I promise! :-)
http://pages.sssnet.com/messndal/church/parachurch.pdf
--
//www.freelists.org/webpage/oracle-l


Other related posts:

  • » Merge command - Delete - Robert Freeman