简体   繁体   中英

to_char function in SQLPLUS

When I run select to_char(SYSDATE-3) from dual from SQL DEVELOPER it gives 26-06-15 . But when I run the same query from SQLPLUS session from Linux its giving -

SQL> select TO_CHAR(SYSDATE-3) from dual;

TO_CHAR(SYSDATE-3)
------------------
26-JUN-15

How to correct this in SQLPLUS?

This is the same value in different format.

You can set the session level date format using

alter session set nls_date_format='dd-mm-yy';

Or you can pass this format in the to_char function

select TO_CHAR(SYSDATE-3, 'dd-mm-yy') from dual;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM