写了一个Update,报缺失关键字,望高手指教
Sql语句如下:
update t_conference_reg
set affirmed_attendee=
(
case affirmed_attendee
when affirmed_attendee like '%张才勇,%' then replace(affirmed_attendee,'张才勇,','')
when affirmed_attendee like '%,张才勇%' then replace(affirmed_attendee,',张才勇','')
when affirmed_attendee like '%张才勇%' then replace(affirmed_attendee,'张才勇','')
)
where affirmed_attendee like '%张才勇%' and attendee not like '%张才勇%'
报“ORA-00905 :缺失关键字”
问题,怎么解决?
------解决方案--------------------有case,必须要有end
case 后面字段干掉
你的条件里已经有字段了,重复
------解决方案--------------------
update t_conference_reg
set affirmed_attendee=
(
case -- 去掉affirmed_attendee
when affirmed_attendee like '%张才勇,%' then replace(affirmed_attendee,'张才勇,','')
when affirmed_attendee like '%,张才勇%' then replace(affirmed_attendee,',张才勇','')
when affirmed_attendee like '%张才勇%' then replace(affirmed_attendee,'张才勇','')
end --加一个end
)
where affirmed_attendee like '%张才勇%' and attendee not like '%张才勇%'