|
Page 3 of 7
RPAD(): This function is used to left pad the the given string with specified character or string.
SQL > SELECT RPAD('BILL ' , 12 , 'CLINTON') FROM DUAL;
RPAD('BILL',
------------
BILL CLINTON
LTRIM(): This function removes specified string from the given string if it is there to the left of given string.
SQL > SELECT LTRIM('GEORGE BUSH', 'GEORGE') FROM DUAL;
LTRIM
-----
BUSH
RTRIM(): This function removes specified string from the given string if it is there to the right of given string.
SQL > SELECT RTRIM('TONY BLAIR', 'AIR') FROM DUAL;
RTRIM('
-------
TONY BL
ASCII(): Displays equivalent ASCII value of a character.
SQL > SELECT ASCII('A') FROM DUAL;
ASCII('A')
----------
65
SQL >SELECT TRANSLATE('JOHN','H','N') FROM DUAL;
TRAN
----
JONN
OTHER FUNCTIONS:
Note: Arguments to the below given functions are in terms of radians
COS(x): It returns the Cosine of x.
SQL> SELECT COS(0) FROM DUAL;
COS(0)
----------
1
COSH(x) : It returns hyperbolic cosine of x.
SQL> SELECT COSH(0) FROM DUAL;
COSH(0)
----------
1
SIN(x) : It returns sine of x.
SQL> SELECT SIN(0) FROM DUAL;
SIN(0)
----------
0
SINH(x): It returns hyperbolic sine of x.
SQL> SELECT SINH(0) FROM DUAL;
SINH(0)
----------
0
TAN(x): It returns tangent of x.
SQL> SELECT TAN(0) FROM DUAL;
TAN(0)
----------
0
TANH(x): It returns hyperbolic tangent of x.
SQL> SELECT TANH(0) FROM DUAL;
TANH(0)
----------
0
DATE FUNCTIONS:
ADD_MONTHS(date, n) : Adds n months to the specified date .
SQL> SELECT ADD_MONTHS('1-JAN-05',5) FROM DUAL;
ADD_MONTHS
------------------
01-JUN-05
LAST_DAY(date): Gives last date of the specified month (date).
SQL> SELECT LAST_DAY('1-JAN-05') FROM DUAL;
LAST_DAY(
---------
31-JAN-05
MONTHS_BETWEEN(date1, date2): It gives difference between the two dates date1, date2 in months.
SQL> SELECT MONTHS_BETWEEN('31-DEC-05','1-JAN-05') FROM DUAL
MONTHS_BETWEEN('31-DEC-05','1-JAN-05')
--------------------------------------
11.9677419
SQL> SELECT MONTHS_BETWEEN('31-JUL-05','1-JUL-05') FROM DUAL
MONTHS_BETWEEN('31-JUL-05','1-JUL-05')
--------------------------------------
.967741935
|