sql> select ename,regexp_replace(ename,'[[:upper:]]+') from emp; ENAME REGEXP_REPLACE(ENAME -------------------- -------------------- SMITH ALLEN WARD JONES MARTIN BLAKE CLARK SCOTT KING TURNER ADAMS ENAME REGEXP_REPLACE(ENAME -------------------- -------------------- JAMES FORD MILLER 14 rows selected.
sql> select ename,'[[:lower:]]+',initcap(ename)) initcap from emp; ENAME -------------------- INITCAP -------------------------------------------------------------------------------- SMITH SMITH ALLEN ALLEN WARD WARD ENAME -------------------- INITCAP -------------------------------------------------------------------------------- JONES JONES MARTIN MARTIN BLAKE BLAKE
通过上面两个例子,对于REGEXP_REPLACE函数要注意的两点: