1;获取当前系统时间
SQL> select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
TO_CHAR(SYSDATE,'YY
-------------------
2016-11-15 07:25:35
SQL>
2:按自己要求输出时间(格式不美观、需要更改)
SQL> select to_date('2005-12-25,13:25:59','yyyy-mm-dd,hh24:mi:ss') from dual;
TO_DATE('
---------
25-DEC-05
SQL>
3:查看参数
SQL> show parameter nls_date
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
nls_date_format string
nls_date_language string
SQL>
4:更改参数
SQL> alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
Session altered.
SQL> select to_date('2005-12-25,13:25:59','yyyy-mm-dd,hh24:mi:ss') from dual;
TO_DATE('2005-12-25
-------------------
2005-12-25 13:25:59
**注:此方法只是在当前的会话下。
SQL> alter system set nls_date_format='yyyy-mm-dd hh24:mi:ss' scope=spfile;
System altered.
***这个是全改的
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31399171/viewspace-2128533/
,如需转载,请注明出处,否则将追究法律责任。