oracle怎样根据case when 条件update纵表的值

2025-05-15 08:51:58
推荐回答(2个)
回答1:

给你看一个例子吧!
update tbForum set UltimoScore=
(case
when AllScore-RemainScore<0 then 0
else AllScore-RemainScore
end),AllScore=
(case
when ActivityDegree>=0 and ActivityDegree<=300 then 250
when ActivityDegree>=301 and ActivityDegree<=800 then 500
when ActivityDegree>=801 and ActivityDegree<=2000 then 1000
when ActivityDegree>=2001 and ActivityDegree<=4000 then 2000
when ActivityDegree>=4001 and ActivityDegree<=8000 then 4500
when ActivityDegree>8000 then 9000
end),UltimoDegree=ActivityDegree,ActivityDegree = 0

回答2:

写到where条件中就可以了吧。