Subject: Merge Command
Posted By: uma_10_5 Post Date: 12/12/2005 3:01:01 AM
Hi,

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

Thanks
Uma
Reply By: ashu_from_india Reply Date: 12/29/2005 2:36:52 AM
hi uma

check this out

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

Reply By: subhendude Reply Date: 1/8/2006 10:33:17 AM
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
subhendude@gmail.com
Software Developer
New Delhi, India
Reply By: uma_10_5 Reply Date: 1/11/2006 1:37:21 AM
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 = ?))

Go to topic 37563

Return to index page 398
Return to index page 397
Return to index page 396
Return to index page 395
Return to index page 394
Return to index page 393
Return to index page 392
Return to index page 391
Return to index page 390
Return to index page 389