Oracle数据库的条件判断函数

  1. decode函数
    decode(条件1,值1,结果1,值2,结果2,结果3);
    notes:条件1和值1相等,输出结果1;条件1和值2相等,输出结果2;否则输出结果3
  2. case when … then … when … then … else … end
    case when 条件1 then 结果1 when 条件2 then 结果2 else 结果3 end as 别名;
    notes:条件1成立输出结果1;条件2成立输出结果2;否则输出结果3

你可能感兴趣的:(Oracle)