Oracle的sql语句的两种判断形式

  1. 判断当前列同时改动当前列
  2. 判断一个情况改动其他值

一类情况详解:实现的是当num这一列的值为3时,就显示好 以此类推

1)case num

      when 3 then

      '好'

      when 1 then

      '不好'

      else

      '还行'

    end taskresult 红色字是给所判断的这个列名的别名 可以不写

        如果num 是一个复杂的公式的时候起别名比较方便

2)case

      when num = 3 then

      '好'

      When num = 1 then

      '不好'

      else

      '还行'

    end 这个方法效果同上

二类情况详解:实现的是当num=3时,score为score(好) 以此类推

case

      when num = 3 then

      trim(score)||'(好)'

      when yq.spqcreq = 1 then

      trim(score)||'(不好)'

      else

      trim(score)||'(还行)'

      end

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-30
  • 2021-12-02
  • 2021-07-10
  • 2021-11-01
  • 2022-12-23
猜你喜欢
  • 2021-07-31
  • 2021-06-26
  • 2022-12-23
  • 2021-08-11
  • 2021-11-20
  • 2021-12-10
  • 2022-01-01
相关资源
相似解决方案