Oracle SQL中的CASE表达式

时间:2019-10-29 13:27:40

标签: sql oracle

使用此SQL查询时出现错误。有人可以帮忙吗?

select *
    case 
        when TO_CHAR (current_date, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') = 'TUE' then "today is tuesday"
        else  "today is not tuesday"
    end as Todate
from
    dual

代码只是一个演示。如果可行,那么我有计划实施更多的东西。

1 个答案:

答案 0 :(得分:2)

如评论中所述,您需要删除*并将"编辑为'

select 
    case 
        when TO_CHAR (current_date, 'DY', 'NLS_DATE_LANGUAGE=ENGLISH') = 'TUE' then 'today is tuesday'
        else  'today is not tuesday'
    end as Todate
from
    dual