-- Extract time from date
select to_char(sysdate,'HH12:MI:SS') from dual
-- EXTRACT method (Another approach)
SELECT EXTRACT(YEAR FROM sysdate) FROM DUAL;
-- selecting the employee who join after 1981
SELECT ename, empno, hiredate
FROM scott.emp
WHERE EXTRACT(YEAR FROM
TO_DATE(hiredate, 'DD-MON-RR')) > 1981
ORDER BY hiredate;
--- BUT I CAN NOT EXTRACT TIME USING EXTRACT FUNCTION, I NORMALLY ---EXTRACT TIME USING TO_CHAR FUNCTION....
No comments:
Post a Comment