關於merge時,出現的ORA-00904 invalid identifier

jidongzheng發表於2008-08-12

今天在寫一個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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章