Search code examples
oracle-databaseoracle11gdatastage

Convert Varchar2(24-JAN-2016) to number (YYYYMMDD


I want to convert varchar2(24-JAN-16) to number(20160124) in Oracle and Datastage.

Can you help me?

Thanks in advance.


Solution

  • If this is a firm requirement - and you can't just use this as a date - then the following SQL will accomplish taking a string, and converting it the the number you want.

    SELECT TO_NUMBER(TO_CHAR(TO_DATE('24-JAN-16','DD-MON-RR'), 'YYYYMMDD')) FROM dual;