繁体   English   中英

Oracle Sql case 语句在 then 中有多个值

[英]Oracle Sql case statement with Multiple values in then

我想编写具有多个 output 值的多个条件的 oracle sql 案例。

例如,

SELECT A,B,
  Case
  When A In(default, non default, Deliquent)  Then ('dl_vint','lw_vint','hg_vint')
from Application 

SQL 查询支持case表达式 表达式返回单个值。 我假设你想要这样的东西:

select A, B,
       (case when A = 'default' then 'dl_vint'
             when A = 'non default' then 'lw_vint'
             when A = 'Deliquent' then 'hg_vint'
        end)
from Application

像这样

SELECT  
  A, B, 
  case A 
    when 'default' THEN 'dl_vint'
    when 'non default' then 'lw_vint'
    when 'Deliquent' then 'hg_vint'
  end
from Application

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM