4. Date Function
1. SELECT SYSDATE FROM DUAL.;
2. SELECT TO_CHAR(SYSDATE ,'DD:MON:YY HH:MI:SS' ) FROM DUAL.;
3. SELECT TO_CHAR(SYSDATE ,'DD/MON/YY HH:MI:SS' ) FROM DUAL.;
4. SELECT TO_CHAR(SYSDATE,'DD/MM/YY HH:MI:SS') FROM DUAL.;
5. SELECT TO_CHAR(SYSDATE ,'DD/MONTH/YYYY' ) FROM DUAL.;
6. SELECT TO_CHAR(SYSDATE ,'MONTH' ) FROM DUAL.;
7. SELECT TO_CHAR(SYSDATE ,'YYYY' ) FROM DUAL.;
8. SELECT TO_CHAR(SYSDATE ,'DD' ) FROM DUAL.;
9. SELECT TO_CHAR(SYSDATE,'Day') FROM DUAL.;
10. SELECT TO_CHAR(SYSDATE ,'DAY') FROM DUAL.;
11. SELECT TO_CHAR(SYSDATE ,'DAY MONTH YEAR') FROM DUAL.;
11. SELECT
TO_CHAR(SYSDATE ,'DAY MONTH YEAR')
FROM DUAL.;
12. SELECT ENAME
,HIREDATE
,ADD_MONTHS(HIREDATE,3)
FROM EMP;
13. SELECT ENAME
,HIREDATE
,ADD_MONTHS(HIREDATE,-3)
,TO_CHAR(ADD_MONTHS(HIREDATE,-3)
,'Month')
FROM EMP;
14. SELECT ENAME
,HIREDATE
,LAST_DAY(HIREDATE)
,LAST_DAY('11-APR-2015')
FROM EMP;
15. SELECT ENAME
,HIREDATE
,MONTHS_BETWEEN('11-APR-2015','31-SEP-2015') FROM EMP;
16. SELECT NEXT_DAY('31-JAN-2015','SATURDAY')
FROM DUAL;
17. SELECT NEXT_DAY('31-JAN-2015','SATURDAY') + 10
FROM DUAL;
18. SELECT SYSDATE - 5
FROM DUAL;
1. SELECT SYSDATE FROM DUAL.;
2. SELECT TO_CHAR(SYSDATE ,'DD:MON:YY HH:MI:SS' ) FROM DUAL.;
3. SELECT TO_CHAR(SYSDATE ,'DD/MON/YY HH:MI:SS' ) FROM DUAL.;
4. SELECT TO_CHAR(SYSDATE,'DD/MM/YY HH:MI:SS') FROM DUAL.;
5. SELECT TO_CHAR(SYSDATE ,'DD/MONTH/YYYY' ) FROM DUAL.;
6. SELECT TO_CHAR(SYSDATE ,'MONTH' ) FROM DUAL.;
7. SELECT TO_CHAR(SYSDATE ,'YYYY' ) FROM DUAL.;
8. SELECT TO_CHAR(SYSDATE ,'DD' ) FROM DUAL.;
9. SELECT TO_CHAR(SYSDATE,'Day') FROM DUAL.;
10. SELECT TO_CHAR(SYSDATE ,'DAY') FROM DUAL.;
11. SELECT TO_CHAR(SYSDATE ,'DAY MONTH YEAR') FROM DUAL.;
11. SELECT
TO_CHAR(SYSDATE ,'DAY MONTH YEAR')
FROM DUAL.;
12. SELECT ENAME
,HIREDATE
,ADD_MONTHS(HIREDATE,3)
FROM EMP;
13. SELECT ENAME
,HIREDATE
,ADD_MONTHS(HIREDATE,-3)
,TO_CHAR(ADD_MONTHS(HIREDATE,-3)
,'Month')
FROM EMP;
14. SELECT ENAME
,HIREDATE
,LAST_DAY(HIREDATE)
,LAST_DAY('11-APR-2015')
FROM EMP;
15. SELECT ENAME
,HIREDATE
,MONTHS_BETWEEN('11-APR-2015','31-SEP-2015') FROM EMP;
16. SELECT NEXT_DAY('31-JAN-2015','SATURDAY')
FROM DUAL;
17. SELECT NEXT_DAY('31-JAN-2015','SATURDAY') + 10
FROM DUAL;
18. SELECT SYSDATE - 5
FROM DUAL;
No comments:
Post a Comment