--■■■case式■■■
select
case when exists(select 1 from dual where RowNum=0) then
(select 2 from dual)
when (select count(*) from dual) > 10 then
(select 3 from dual)
when (1,2) in(select 1,3 from dual
union all select 3,2 from dual) then 4
when (select 5 from dual) = (select 6 from dual) then
(select 7 from dual)
when (select 8 from dual) between (select 9 from dual) and (select 10 from dual) then
(select 11 from dual)
when (select 'abc' from dual) Like (select 'a*d' from dual) then
(select 12 from dual)
else (select 13 from dual) + (select 14 from dual)
end as Val1,
15,16 from dual;
--■■■decode関数■■■
select decode((select 5 from dual),1,10,100),decode(2,1,10,100) from dual;
--■■■nvl2関数■■■
select
nvl2(null,'nullじゃないです','nullです'),
nvl2('2' ,'nullじゃないです','nullです')
from dual;
--■■■nvl関数■■■
select nvl(null,50),nvl(2,50) from dual;
--■■■coalesce関数■■■
select coalesce(null,50,60),coalesce(2,50,60) from dual;
--■■■sign関数■■■
select sign(3),sign(0),sign(-10) from dual;
--■■■nullif関数■■■
select nullif(3,3),nullif(5,4) from dual;
--■■■translate関数■■■
select translate('abcdef','012345') from dual;
--■■■greatest関数■■■
select greatest(1,10) from dual;
--■■■Least関数■■■
select Least(1,10) from dual;
--■■■abs関数とcase式■■■
select case when abs((select 6 from dual)) > 5 then 1 else 2 end from dual;