2
爲什麼只有第一個工作?案例表達式和布爾值
回報 '藍色':
select case when 'a' = 'a' then 'blue' end from dual;
錯誤:ORA-00920:無效的關係運算符
select case when true then 'blue' end from dual;
ORA-00904: 「TRUE」:無效標識符
select case when 'a' = 'a' then true end from dual;
ORA-00905:缺少關鍵字
select case when 'b' = 'b' then 'a' = 'a' end from dual;
確實沒有'true'或'false'SQL關鍵字,但是'a'='a''評估爲布爾值,不使用Y/N或0/1。 Oracle'case'表達式是Oracle SQL中使用布爾值(作爲條件而不是結果)的一個地方,類似於where子句的條件。 – GriffeyDog