In this article we will
discuss few SQL functions useful while working daily. SQL functions are kind of
predefined packages/procedure, can be used in different aspects, lets discuss one
by one
LENGTH
Syntax - LENGTH(String)
This function returns the
total number of characters present in the string
Example
SQL> SELECT LENGTH('Interest') from dual;
LENGTH('INTEREST')
------------------
8
ASCII
Syntax – ASCII(char)
This function gives ASCII
value of given character
Example
SQL> SELECT ASCII('B') from dual;
ASCII('B')
----------
66
SQL> SELECT ASCII('I') from dual;
ASCII('I')
----------
73
SUBSTR
Syntax - SUBSTR (string,
position, sub-string_length)
This substring function
return a portion of string, starting at character position, sub-string_length
characters long.
SUBSTR calculates length
using characters as defined by the input character set
SQL>
select SUBSTR('entertainment',4,10) from dual;
SUBSTR('EN
----------
ertainment
SQL>