zgqynx 发表于 2013-2-4 20:20:29

oracle case

select a.id,a.colA ,
    case when a.colA='11' then '这是11'
         when a.colA='22' then '这是22'         
         else '例外'
    end anyNameYouLike
   
from TA a


update students
set grade = (
select grade from
(
select id,
case when current_credits > 90 then 'a'
   when current_credits > 80 then 'b'
   when current_credits > 70 then 'c'
else 'd' end grade
from students
) a
where a.id = students.id
)
页: [1]
查看完整版本: oracle case