我正在尝试在我的iBatis 2 xml文件中使用合并语句。合并(更新/插入)如下所示:
<update id="insertTaxPer" parameterClass="per">
MERGE INTO tax_retry USING DUAL
ON (per_id= #perId#)
WHEN MATCHED THEN
UPDATE SET
<isNotNull property="perTitle">
per_title = #perTitle#
</isNotNull>
WHEN NOT MATCHED THEN
INSERT INTO PE_AUTH_REENTRY(
per_id,
per_no,
per_title)
VALUES(
#perId#,
#perNo#,
#perTitle#
)
</update>
Getting the below error
Caused by: org.springframework.jdbc.BadSqlGrammarException: SqlMapClient operation; bad SQL grammar []; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred while applying a parameter map.
--- Check the insertRenTryPublication-InlineParameterMap.
--- Check the statement (update failed).
--- Cause: java.sql.SQLException: ORA-00926: missing VALUES keyword
while executing sql:
MERGE INTO tax_retry USING dual ON ( per_id =?)
WHEN MATCHED THEN UPDATE SET per_title =?
WHEN NOT MATCHED THEN
INSERT INTO tax_retry( per_id, per_no, per_title)
VALUES( ?, ?, ?) with parameters:
[53961, 53961, TESTER]
我无法升级到更高版本或mybatis,因为它是旧版应用程序。有输入吗?