In this article you will learn how to convert date to number in Oracle SQL, by using functions TO_NUMBER() and TO_CHAR() we can convert date to number. The TO_NUMBER function returns a numeric value, and TO_CHAR function returns a string value.
Syntax to convert data to number in Oracle SQL
–Syntax–
TO_NUMBER(TO_CHAR(SYSDATE,’DDMMRRRR’))
–Query–
SELECT TO_NUMBER(TO_CHAR(SYSDATE, ‘DDMMRRRR’)) FROM dual;
–Output–
02112021