今天在写一个merge语句时,总是出现上述错误。
merge into JCSS_TicketInfo TT using v_ocainfo v_with
on ( tt.TICKETSEQ = v_with.ticketSeq)
when matched then update set
ticketSeq = v_with.ticketSeq ,
acceptTime = v_with.acceptTime ,
iceFullName = v_with.serviceFullName ,
userCity = v_with.userCity ,
userPhone = v_with.userPhone ,
userLevel = v_with.userLevel ,
serviceType = v_with.serviceType ,
serviceContent = v_with.serviceContent ,
ifComplainRepeat = v_with.ifComplainRepeat ,
userHopeResTime = v_with.userHopeResTime ,
userHlr = v_with.userHlr ,
place = v_with.place ,
terminalType = v_with.terminalType ,
spCode = v_with.spCode ,
serviceCode = v_with.serviceCode ,
groupId = v_with.groupId ,
groupName = v_with.groupName ,
groupType = v_with.groupType
when not matched then
insert( ticketSeq,
acceptTime,
serviceFullName,
userCity,
userPhone,
userLevel,
serviceType,
serviceContent,
ifComplainRepeat,
userHopeResTime,
userHlr,
place,
terminalType,
spCode,
serviceCode,
groupId,
groupName,
groupType
)
values(
v_with.ticketSeq,
v_with.acceptTime,
v_with.serviceFullName,
v_with.userCity,
v_with.userPhone,
v_with.userLevel,
v_with.serviceType,
v_with.serviceContent,
v_with.ifComplainRepeat,
v_with.userHopeResTime,
v_with.userHlr,
v_with.place,
v_with.terminalType,
v_with.spCode,
v_with.serviceCode,
v_with.groupId,
v_with.groupName,
v_with.groupType) ;
检查我的语句,也没有字段错误啊。
后来,查看oracle sql Reference
发现:
Restrictions on the merge_update_clause This clause is subject to the following restrictions:
You cannot update a column that is referenced in the
ON
condition
clause.You cannot specify
DEFAULT
when updating a view.
经修改,取消了针对匹配条件的update列。问题解决。
[@more@]来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/197458/viewspace-1008850/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/197458/viewspace-1008850/