How to display date in a different format in oracle

前端 未结 4 1254
萌比男神i
萌比男神i 2020-12-18 22:04

I have a table with a date field. By default, select max(date) from table; returns the date in \'dd-mmm-yy\' format. How do I select the date in \'MM/DD/YYYY\'

4条回答
  •  独厮守ぢ
    2020-12-18 22:41

    Exists a table or view v$nls_parameters search here the parameter 'NLS_DATE_FORMAT', this is perfect for not be changing the format each while.

    SELECT * 
      FROM v$nls_parameters WHERE UPPER(PARAMETER) = 'NLS_DATE_FORMAT';
    
    ALTER SESSION SET NLS_DATE_FORMAT = 'YYYYMMDD'; 
    

    There is also the possibility from make for register of win. in tree

    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE\KEY_OraClient11g_home9
    

    Here key NLS_DATE_FORMAT, change for your format date.

提交回复
热议问题