--
tanslate(str,from_str,to_str)
--
将str中的from_str替换成to_str
select
translate(
'
hello
'
,
'
e
'
,
'
o
'
) t
from
dual;
--
instr(str,des_str)
--
可以实现like功能
select
instr(
'
hello
'
,
'
g
'
),instr(
'
hello
'
,
'
h
'
),instr(
'
hello
'
,
'
l
'
)
from
dual;
--
decode(value,s1,r1,s2,r2,default)
--
类似于if else
select
decode(
'
1
'
,
'
1
'
,
'
一级部门
'
,
'
2
'
,
'
二级部门
'
,
'
其他部门
'
)
as
dept
from
dual;
--
case表达式
select
case
1
when
1
then
'
001
'
when
2
then
'
002
'
else
'
003
'
end
as
le
from
dual;
--
层次化查询(树形结构)
select
level
,id,pid,name
from
t_test
start
with
pid
is
null
connect
by
prior id
=
pid;

