SQL Functions
SQL Functions
1. DATE FUNCTIONS
Output:
ADD_MONTH
------------------
07-APR-23
II. LAST_DAY – Returns the date corresponding to the last day of the month.
Output:
SYSDATE LAST_DAY
------------- --------------
07-FEB-23 28-FEB-23
Output:
MONTHS_BETWEEN ('01-APR-23', '01-FEB-23')
--------------------------------------------------------------
2
IV. NEXT_DAY – Returns the next date for the specified day from the specified date.
Output:
NEXT_DAY
------------------
14-FEB-23
GREATEST
-----------------
10-JUL-23
Ltrim (char, set) select ltrim (‘xyzadams’, ‘xyz’) from dual; adams
Rtrim (char, set) select rtrim (‘xyzadams’, ‘ams’) from dual; xyzad
Translate (char, from, to) select translate (‘jack’, ‘j’, ‘b’) from dual; back
Replace (char, select replace (‘jack and jue’, ‘j’, ‘bl’) from
black and blue
searchstring, [rep string]) dual;
The output gives the sign ‘=’ before the word function. The entire string is 15 in
length after the padding is done.
Output:
LPAD ('FUNCTION'
--------------------------
= = = = = = =function
II. RPAD – Pads the value given to the right of the given string.
Output:
RPAD ('FUNCTION'
--------------------------
Function= = = = = = =
3. NUMERIC FUNCTIONS