4 TH Experiment
4 TH Experiment
a) Conversion Functions:
1. to_char: to_char is used to convert the attribute values to char.
SQL> select to_char(salary,'$99999.99') from emp;
TO_CHAR(SALARY)
$15000.00
$20000.00
$42000.00
$23000.00
$50000.00
SQL> SELECT TO_CHAR (123.4567, '99999.9') FROM DUAL;
TO_CHAR (
123.5
SQL> SELECT TO_CHAR(123.4567, '99999.99') FROM DUAL;
TO_CHAR(1
123.46
TO_DATE(' 01-JAN-20
b) String functions:
1. Concatenation: CONCAT is used to add two attribute values such as
string.
2. lpad: LPAD() function is used to padding the left side of a string with a
specific set of characters.
c) Date functions:
1. Sysdate(): sysdate() function returns the current system date.
29-FEB-20
5. months_between(): it returns the numbers of months between given two dates.