Sunday, August 15, 2010
Oracle 11g: Character-Manipulation Functions
select 'Hello World' from dual;
select CONCAT('Hello World', 'Peah') from dual;
select SUBSTR('Hello World', 1,5) from dual;
select LENGTH('Hello World') from dual;
select INSTR('Hello World', 'W') from dual;
select LPAD('Hello World', 20,'*') from dual;
select RPAD('Hello World', 20,'*') from dual;
select REPLACE('Hello World', 'l','x') from dual;
select TRIM('H' FROM 'Hello World') from dual;
Results
'HELLOWORLD'
------------
Hello World
CONCAT('HELLOWORLD','PEAH')
---------------------------
Hello WorldPeah
SUBSTR('HELLOWORLD',1,5)
------------------------
Hello
LENGTH('HELLOWORLD')
----------------------
11
INSTR('HELLOWORLD','W')
-----------------------
7
LPAD('HELLOWORLD',20,'*')
-------------------------
*********Hello World
RPAD('HELLOWORLD',20,'*')
-------------------------
Hello World*********
REPLACE('HELLOWORLD','L','X')
-----------------------------
Hexxo Worxd
TRIM('H'FROM'HELLOWORLD')
-------------------------
ello World
select CONCAT('Hello World', 'Peah') from dual;
select SUBSTR('Hello World', 1,5) from dual;
select LENGTH('Hello World') from dual;
select INSTR('Hello World', 'W') from dual;
select LPAD('Hello World', 20,'*') from dual;
select RPAD('Hello World', 20,'*') from dual;
select REPLACE('Hello World', 'l','x') from dual;
select TRIM('H' FROM 'Hello World') from dual;
Results
'HELLOWORLD'
------------
Hello World
CONCAT('HELLOWORLD','PEAH')
---------------------------
Hello WorldPeah
SUBSTR('HELLOWORLD',1,5)
------------------------
Hello
LENGTH('HELLOWORLD')
----------------------
11
INSTR('HELLOWORLD','W')
-----------------------
7
LPAD('HELLOWORLD',20,'*')
-------------------------
*********Hello World
RPAD('HELLOWORLD',20,'*')
-------------------------
Hello World*********
REPLACE('HELLOWORLD','L','X')
-----------------------------
Hexxo Worxd
TRIM('H'FROM'HELLOWORLD')
-------------------------
ello World
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment