tags:

views:

971

answers:

1
    MERGE INTO PAGEEDITCONTROL A
      USING (SELECT
              '1585' AS PAGEID
       ,'admin' AS EDITUSER
       ,sysdate AS EDITDATE
          FROM DUAL) B
      ON (A.PAGEID = B.PAGEID)
      WHEN MATCHED THEN
      UPDATE SET
      A.EDITUSER = B.EDITUSER
     ,A.EDITDATE = B.EDITDATE
      WHEN NOT MATCHED THEN
   INSERT  (
      A.PAGEID
     ,A.EDITUSER
     ,A.EDITDATE
      )VALUES(
      B.PAGEID
     ,B.EDITUSER
     ,B.EDITDATE
      )
+1  A: 

MySQL has a similar construct which looks less like an upsert, but more like an insate: INSERT ... ON DUPLICATE KEY UPDATE (see the MySQL reference manual).

Henning