我无法弄清楚这个合并声明有什么问题。它工作正常,然后我在声明中添加了COL2,遵循我认为的相同模式,但我得到这个错误,这似乎表明它来自对表的别名?
Caused by: org.h2.jdbc.JdbcSQLException: Syntax error in SQL statement "MERGE INTO MY_TABLE RBX[*] USING ( SELECT ? COL1,? COL2,? COL3,? COL4, ? COL5, ? COL6,? UPDATED_TS FROM DUAL) R ON (RBX.COL1 = R.COL1 AND RBX.COL5 = R.COL5) WHEN MATCHED THEN UPDATE SET RBX.COL3 = R.COL3, RBX.COL4 = R.COL4, RBX.COL6 = R.COL6, RBX.COL2 = R.COL2, RBX.UPDATED_TS = R.UPDATED_TS WHEN NOT MATCHED THEN INSERT(COL1, COL2, COL3, COL4, COL5, COL6, UPDATED_TS) VALUES(R.COL1, R.COL2, R.COL3, R.COL4, R.COL5, R.COL6, R.UPDATED_TS)";expected "., (, KEY, VALUES, (, WITH, SELECT, FROM";SQL statement:
陈述是:
MERGE INTO MY_TABLE RBX
USING ( SELECT ? COL1,? COL2,? COL3,? COL4, ? COL5, ? COL6,? UPDATED_TS
FROM DUAL) R
ON (RBX.COL1 = R.COL1 AND RBX.COL5 = R.COL5)
WHEN MATCHED THEN
UPDATE SET RBX.COL3 = R.COL3, RBX.COL4 = R.COL4, RBX.COL6 = R.COL6,
RBX.COL2 = R.COL2,
RBX.UPDATED_TS = R.UPDATED_TS
WHEN NOT MATCHED THEN
INSERT(COL1, COL2, COL3, COL4, COL5, COL6, UPDATED_TS) VALUES(R.COL1,
R.COL2, R.COL3, R.COL4, R.COL5, R.COL6, R.UPDATED_TS) [42001-196]
我容易失明,但这句话对我来说是正确的。错误是否可能是其他原因的结果?表设置等?
特别是,有人可以解释这意味着什么:
";expected "., (, KEY, VALUES, (, WITH, SELECT, FROM";