MERGE INTO [your table-name] [rename your table here]
USING ( [write your query here] )[rename your query-sql and using just like a table]
ON ([conditional expression here] AND [...]...)
WHEN MATCHED THEN [here you can execute some update sql or something else ]
WHEN NOT MATCHED THEN [execute something else here ! ]
----------------------------------------
MERGE INTO KEYWORD T1
USING (SELECT :NAME AS NAME,:PIN_YIN AS PIN_YIN,:PIN_YIN_FIRST AS PIN_YIN_FIRST,1 As TIMES FROM dual) T2
ON (T1.NAME=T2.NAME)
WHEN MATCHED THEN
UPDATE SET T1.TIMES = T1.TIMES + 1
WHEN NOT MATCHED THEN
INSERT(NAME,PIN_YIN,PIN_YIN_FIRST,TIMES) VALUES(T2.NAME,T2.PIN_YIN,T2.PIN_YIN_FIRST,T2.TIMES)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26549969/viewspace-746575/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26549969/viewspace-746575/