Oracle和Cognos Framework Manager中decode妙用,CASE WHEN也可以!
我们都知道Decode函数可以用来做什么作用,如果这个不知道的话,请找下度娘。
那么,今天就来介绍一下,在WHERE条件语句里面使用Decode函数。
?
由浅入深,先一步一步来。。
with tmp as(select 1 id, 'kelly' name from dual union allselect 2 id, 'sam' name from dual union allselect 3 id, 'jason' name from dual union allselect 4 id, 'kobe' name from dual union allselect 5 id, null name from dual)select id, name from tmpwhere id = case when length(name)>1 then length(name) else 5 end;
?
?
?
?
?
?
?
?
?