1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

How to change this update dml to merge

Discussion in 'SQL PL/SQL' started by 13478, Jul 27, 2016.

  1. 13478

    13478 Active Member

    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    80
    Location:
    Louisana
    Hello,

    I have a update:

    UPDATE /*+ PARALLEL */ MF_HELLO a SET a.EMPLOYEE_NAME = (SELECT /*+ PARALLEL */ d.EMPLOYEE_NAME FROM MF_WORLD d ,MF_LIFE ds WHERE ds.DOC_ID = d.uidy AND ds.uidy = a.docs_id)
    WHERE EXISTS (SELECT /*+ PARALLEL */ 1 FROM MF_WORLD d ,MF_LIFE ds WHERE ds.DOC_ID = d.uidy AND ds.uidy = a.docs_id);

    How to change it to use MERGE?

    ( I tried like,

    MERGE /*+ parallel */ INTO MF_HELLO n
    USING MF_WORLD o, MF_LIFE ds
    ON (ds.DOC_ID = o.uidy AND ds.uidy = n.docs_id)
    WHEN matched THEN UPDATE /*+ parallel */ SET n.EMPLOYEE_NAME = o.EMPLOYEE_NAME;

    ORA-00969: missing ON keyword

    )

    Thank you very much!!!
     
  2. Vicky

    Vicky Forum Advisor

    Messages:
    261
    Likes Received:
    11
    Trophy Points:
    260
    Location:
    Chennai

    It's Syntax Error. Check the Syntax for Merge Statement here:

    http://www.oracle-developer.net/display.php?id=203
     
  3. krasnoslobodtsev_si

    krasnoslobodtsev_si Forum Genius

    Messages:
    626
    Likes Received:
    129
    Trophy Points:
    810
    Location:
    Russian Federation
    Hi.
    1) MERGE not working on PDML
    2)
    Code (SQL):
    MERGE INTO mf_hello n
    USING (SELECT z.employee_name,ds.uidy
           FROM mf_world z, mf_life ds
           WHERE ds.doc_id = z.uidy
          )
    ON (n.docs_id = o.uidy)
    WHEN matched THEN UPDATE  SET n.employee_name = o.employee_name;
     
  4. 13478

    13478 Active Member

    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    80
    Location:
    Louisana

    Got you, thank you very much!!!
     
  5. 13478

    13478 Active Member

    Messages:
    31
    Likes Received:
    0
    Trophy Points:
    80
    Location:
    Louisana