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
)
views:
971answers:
1
+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
2008-12-27 13:21:44