9,Replace
select replace('abc','b','xy') from dual;
10,translate
select translate('abc','b','xx') from dual; -- x是1位
11, decode[实现if ..then 逻辑] 注:第一个是表达式,最后一个是不满足任何一个条件的值
select deptno,decode(deptno,10,'1',20,'2',30,'3','其他') from dept;
例:
select seed,account_name,decode(seed,111,1000,200,2000,0) from t_userInfo//如果seed为111,则取1000;为200,取2000;其它取0
select seed,account_name,decode(sign(seed-111),1,'big seed',-1,'little seed','equal seed') from t_userInfo//如果seed>111,则显示大;为200,则显示小;其它则显示相等
12, case[实现switch ..case 逻辑]
SELECT CASE X-FIELD
WHEN X-FIELD < 40 THEN 'X-FIELD 小于 40'
WHEN X-FIELD < 50 THEN 'X-FIELD 小于 50'
WHEN X-FIELD < 60 THEN 'X-FIELD 小于 60'
ELSE 'UNBEKNOWN'
END
FROM DUAL