create table t(a varchar2(10));
insert into t values('北京ABc');
insert into t values('abc北京');
select regexp_substr(a,'[a-zA-Z]+') "英文",
regexp_substr(a,'[^a-zA-Z]+') "汉字"
from t;
SYS@PROD>select regexp_substr(a,'[a-zA-Z]+') "英文", regexp_substr(a,'[^a-zA-Z]+') "汉字" from t;
英文 汉字
-------------------- --------------------
abc 北京
ABc 北京
SQL> WITH strings AS (
2 SELECT 'abc123' s FROM dual
3 union all
4 SELECT '123abc' s FROM dual
5 union all
6 SELECT 'a1b2c3' s FROM dual
7 )
8 select strings.s,regexp_replace(s,'[0-9]','') num_1,regexp_replace(s,'\d','') num_2 from strings;
S NUM_1 NUM_2
------ ---------------------------------- ------------------------------------------------------------------------
abc123 abc abc
123abc abc abc
a1b2c3 abc abc
SQL> select regexp_count('ABC123', '[A-Z]') test1,
2 regexp_count('A1B2C3', '[A-Z]') test2
3 from dual;
TEST1 TEST2
---------- ----------
3 3
with t as
(select 'aaa,ccc,dddfff' strings from dual)
select regexp_replace(t.strings,',',chr(10)) from t;
REGEXP_REPLACE
--------------
aaa
ccc
dddfff
SQL> select substr(sys_connect_by_path(ename,'-->'),4) "path" from emp
2 where mgr is null
3 connect by empno=prior mgr;
path
--------------------------------------------------------------------------------
SMITH-->FORD-->JONES-->KING
ALLEN-->BLAKE-->KING
WARD-->BLAKE-->KING
JONES-->KING
MARTIN-->BLAKE-->KING
BLAKE-->KING
CLARK-->KING
KING
TURNER-->BLAKE-->KING
JAMES-->BLAKE-->KING
FORD-->JONES-->KING
MILLER-->CLARK-->KING
12 rows selected