Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > Oracle
|
Oracle General Oracle database discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Oracle section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 12th, 2005, 04:01 AM
Registered User
 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Merge Command

Hi,

 Does any one have an idea on MERGE command in oracle.

Thanks
Uma
 
Old December 29th, 2005, 03:36 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 224
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to ashu_from_india Send a message via Yahoo to ashu_from_india
Default

hi uma

check this out

http://www.dba-oracle.com/oracle_tips_rittman_merge.htm

 
Old January 8th, 2006, 11:33 AM
Authorized User
 
Join Date: Nov 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

MERGE INTO copy_emp c
  USING employees e
  ON (c.empid=e.empid)
WHEN MATCHED THEN
  UPDATE SET
    c.firstname=e.firstname,
    c.lastname=e.lastname,
WHEN NOT MATCHED THEN
  INSERT VALUES(e.empid,e.firstname,e.lastname)

Subhendu De
[email protected]
Software Developer
New Delhi, India
 
Old January 11th, 2006, 02:37 AM
Registered User
 
Join Date: Dec 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

 Thanks for the tips.
 I have incorporated a different solution -
INSERT INTO TABLE_NAME (ID, EFF_DT, END_DT)
(SELECT ?, ?, ? FROM DUAL WHERE NOT EXISTS
(SELECT EFF_DT, FROM TABLE_NAME WHERE EFF_DT = ?))





Similar Threads
Thread Thread Starter Forum Replies Last Post
Command text was not set for the command object Sheraz Khan Classic ASP Databases 2 May 29th, 2007 12:57 AM
How to merge 2 sql's Dr Robert James Beginning PHP 3 December 9th, 2004 02:23 PM
Command text was not set for the command object. deepa12 BOOK: Beginning ASP 3.0 5 November 2nd, 2004 05:37 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.