String functions or Text functions in sql

Ij
Posted by Ij under Oracle category on | Points: 40 | Views : 489
select initcap('neoapp tech hyd') from dual;
...
select upper('computer') from dual;
....COMPUTER
select length('computer') from dual;
...find the length of given string
select ename,length(ename) from emp where length(ename)=5;

select ltrim('     suresh') from dual;
..remove blank space from leftside of a string
select rtrim('computer    ') from dual;
....remove blank space from rightside of a string
select trim('     computer    ') from dual;
..remove blank space from both side of a string
select ascii('A') from dual;
..returns ascii code of a given string
select concat('chandu','bandi') from dual;
..to concatinate two strings into a single string
select substr('computer',4,3) from dual;
....it is used to extract a user required string from a given string based on starting position and number of charecters.
select replace('chandrika','andrika','engamma') from dual;
...it is used to search for text2 in text1 and replace text3 at all the occurances of text2 in text1.
select instr('suresh','h') from dual;
...if position is specified then it will search text from that position.
select lpad('computer',20,'*') from dual;
...it is used to disply text1 with size n charecters and provides left padding with text2
select rpad('suresh',20,'*') from dual;
...it is used to disply text1 with size n charecters and provides right padding with text2

Comments or Responses

Login to post response