HSQLDB 合并 WHEN MATCHED AND 失败
Posted
技术标签:
【中文标题】HSQLDB 合并 WHEN MATCHED AND 失败【英文标题】:HSQLDB merge WHEN MATCHED AND fails 【发布时间】:2016-02-17 19:57:37 【问题描述】:我有以下表格:
create table WorkPendingSummary
(
WorkPendingID int not null,
WorkPendingDate date not null,
Status varchar(20) not null,
EndDate date null
)
create table WorkPendingSummaryStage
(
WorkPendingID int not null,
WorkPendingDate date not null,
Status varchar(20) not null
)
然后我有以下合并语句:
MERGE INTO WorkPendingSummary w USING WorkPendingSummaryStage
AS vals(WorkPendingID, WorkPendingDate, Status)
ON w.WorkPendingID = vals.WorkPendingID
WHEN MATCHED AND vals.status = 'CLOSED'
THEN UPDATE SET w.workpendingdate = vals.workpendingdate, w.status = vals.status, w.enddate = current_time
http://hsqldb.org/doc/guide/dataaccess-chapt.html#dac_merge_statement 上的文档指出,“WHEN MATCHED”语句可以有一个额外的“AND”子句,就像我上面所说的那样,但是失败了:
unexpected token: AND required: THEN : line: 4 [SQL State=42581, DB Errorcode=-5581]
此功能是否有效,还是我只是遗漏了什么? 使用 HSQLDB 2.3.1。
谢谢!
【问题讨论】:
【参考方案1】:该文档适用于版本 2.3.3 和即将发布的 2.3.4。这些最新版本支持 AND 子句。
【讨论】:
以上是关于HSQLDB 合并 WHEN MATCHED AND 失败的主要内容,如果未能解决你的问题,请参考以下文章