-1
我試圖通過以下查詢來dashdb:dashDB:在「」後面找到一個意外的標記「IF」。預期的令牌可能包括:「<call>」。 SQLSTATE = 42601
IF (NOT EXISTS (SELECT * FROM TEST_CONFIGURATION WHERE DEVICEID = 'OZ_POLLUDRON_010'))
BEGIN
INSERT INTO TEST_CONFIGURATION (DEVICEID, DEVICETYPE, SERIAL, TYPE, MACID, CONFIG, INIT) VALUES('OZ_POLLUDRON_010', 'POLLUDRON_PRO', '9428424248', 0, '200050000b51343334363138', '[object Object]', '[object Object]')
END
ELSE
BEGIN
UPDATE TEST_CONFIGURATION SET DEVICEID = 'OZ_POLLUDRON_010', DEVICETYPE = 'POLLUDRON_PRO', SERIAL = '9428424248', TYPE = 0, MACID = '200050000b51343334363138', CONFIG = '[object Object]', INIT = '[object Object]' WHERE DEVICEID = 'OZ_POLLUDRON_010' END
但它給我以下錯誤:
database/sql/driver: [IBM][CLI Driver][DB2/LINUXX8664] SQL0104N An unexpected token "IF" was found following " ". Expected tokens may include: "<call>". SQLSTATE=42601
任何人都可以請幫我呢?
請問你能分享一些例子的鏈接嗎? – Freddy
DB2中端MERGE語句的語法(示例接近頁尾) https://www.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.sql.ref。 DOC/DOC/r0010873.html – mao