| 目次 |
|---|
|
・case ・case条件で検索条件を変更 |
case 比較対象フィールド when 比較値1 then 代替値1
[when 比較値2 then 代替値2]
.....
[else デフォルト値]
end
select
case 3 when 3 then 'three'
when 4 then 'four'
end as case
from dual;
case
--------
three
select
case 5 when 3 then 'three'
when 4 then 'four'
else 'none'
end as case
from dual;
case
----
none
select
case 5 when 3 then 'three'
when 4 then 'four'
end as case
from dual;
case
----
null
SELECT *
FROM TABLE
WHERE
(CASE WHEN FLG = '1' THEN HINBAN
WHEN FLG = '0' THEN HEN_HINBAN
END
) LIKE 'SB_%'