Database   Sql   Functions   Packages   Performance   Books   Oracle   Other   About   XML   ORA-messages
  substr function


Oracle (var)char functions
Instr function
Number format
Kill oracle session
to_date function
Oracle sysdate
Oracle substr
How to use the DECODE statement
How to use the CASE statement
How to use the NVL statement
Using XML functions
Oracle date format
Oracle numeric functions
Oracle date functions
Pl sql trim


The Oracle substr function

The substr function is a function that returns a substring from a string.


substr([input],[start],[length]) or
substr([input],[start]) or
With input the String to take a substring from,
start is the starting position where 1 is the first character. (if you pass 0, this will be substituted by 1) and the optional length parameter is the number of characters in the substring. If length is left out, then substr will return the substring from position start till the end of the input-string.

Sample code:

select substr('1234567890',3,2) from dual;
will return: '34'.

select substr('1234567890',7) from dual;
will return: '7890'.