SQL> select upper('abcde') from dual;
UPPER
-----
ABCDE
SQL> select lower('ABCDE') from dual;
LOWER
-----
abcde
SQL> select inicap(ename) from emp;
select inicap(ename) from emp
*
第 1 行出現錯誤:
ORA-00904: "INICAP": 標識符無效
SQL> select initcap(ename) from emp;
INITCAP(EN
----------
Smith
Allen
Ward
Jones
Martin
Blake
Clark
Scott
King
Turner
Adams
INITCAP(EN
----------
James
Ford
Miller
易發寶
Hr
已選擇16行。
SQL> select concat('a','b') from dual;
CO
--
ab
SQL> select 'a'||'b' from dual;
'A
--
ab
SQL> select substr('abcde',length('abcde')-2) from dual;
SUB
---
cde
SQL> select substr('abcde',-3,3) from dual;
SUB
---
cde
SQL> select substr('abcde',1,3) from dual;
SUB
---
abc
SQL> select substr('abcde',-1,3) from dual;
S
-
e
SQL> select substr('abcde',-4,3) from dual;
SUB
---
bcd
SQL> select length(ename) from emp;
LENGTH(ENAME)
-------------
5
5
4
5
6
5
5
5
4
6
5
LENGTH(ENAME)
-------------
5
4
6
3
2
已選擇16行。
SQL> select replace(ename,'a','A') from emp;
REPLACE(EN
----------
SMITH
ALLEN
WARD
JONES
MARTIN
BLAKE
CLARK
SCOTT
KING
TURNER
ADAMS
REPLACE(EN
----------
JAMES
FORD
MILLER
易發寶
HR
已選擇16行。
SQL> select replace('易法寶','法','發') from dual;
REPLAC
------
易發寶
SQL> select instr('hello world','or') from dual;
INSTR('HELLOWORLD','OR')
------------------------
8
SQL> select lpad('smith',20,'*') from dual;
LPAD('SMITH',20,'*')
--------------------
***************smith
SQL> select rpad('smith',20,'*') from dual;
RPAD('SMITH',20,'*')
--------------------
smith***************
SQL> select trim(' mr smith ') from dual;
TRIM('MRSM
----------
mr smith
SQL> spool off