decode与case when
语法
decode(条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值)
select * from reglike; select decode(substr(name,1,3),'aaa','yes','no') decode from reglike;
语法
case when 条件1 then 值1 when 条件2 then 值2 ... when 条件n then 值n else 缺省值 end
select * from reglike; select case when substr(name,1,3)='aaa' then 'yes' else 'no' end case from reglike;