oracle SQL中的if-elseif-else'condition' [英] if-elseif-else 'condition' in oracle SQL

查看:72
本文介绍了oracle SQL中的if-elseif-else'condition'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有可能实现类似的目标

I am wondering if there if possibility to achieve some thing like

'if-elseif-else'条件,我知道有一个'case-then-then-then-else',但它一次只检查一个条件(如果我正确理解的话).如何在Oracle sql中实现if-elseif-else场景

'if-elseif-else' condition , i know there is a 'case-when-then-else' but it checks only one condition at a time (if i understand it correctly). How can i achieve if-elseif-else scenario in Oracle sql

推荐答案

您可以使用if/else这样的case语句.

You can use if/else using case statements like this.

SELECT ename, CASE WHEN sal = 1000 THEN 'Minimum wage'
                   WHEN sal > 1000 THEN 'Over paid'
                   ELSE 'Under paid'
              END AS "Salary Status"
FROM   emp;

这篇关于oracle SQL中的if-elseif-else'condition'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆