TO_DATE function in ORACLE

前端 未结 4 998
伪装坚强ぢ
伪装坚强ぢ 2021-01-28 06:07

I was trying the TO_DATE function. Specifically, I noted that the following queries

1. SELECT TO_CHAR(TO_DATE(\'01-01-2015\',\'DD-MM-YYYY\'),\'DD-MO         


        
4条回答
  •  走了就别回头了
    2021-01-28 06:44

    Oracle TO_DATE: is used to convert a character string to a date format.

    and related to your concern; you need to alter your session like below:

    alter session set nls_date_format='DD-MM-YYYY'
    

    in your apps right after the connect.

    So now if you run again your query :

    SELECT TO_DATE ('01-01-2015', 'DD-MM-YYYY')
    FROM DUAL;
    

    the result would be as expected:

    01-01-2015

    Hope that will help.

提交回复
热议问题