Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, santhoshreddy.

Asked: August 21, 2017 - 2:06 am UTC

Last updated: August 22, 2017 - 3:36 am UTC

Version: 12C

Viewed 10K+ times! This question is

You Asked

Hi,

In database_properties table date format is in 'DD-MON-RR', but in table it showing different format in date columns.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing opt
ions

SQL> select * from database_properties where PROPERTY_NAME = 'NLS_DATE_FORMAT'
2 ;

PROPERTY_NAME
--------------------------------------------------------------------------------

PROPERTY_VALUE
--------------------------------------------------------------------------------

DESCRIPTION
--------------------------------------------------------------------------------

NLS_DATE_FORMAT
DD-MON-RR
Date format


SQL> SELECT created,last_ddl_time,TIMESTAMP FROM dba_objects WHERE object_TYPE =
'TABLE' AND object_name = 'LINK$';

CREATED LAST_DDL_ TIMESTAMP
--------- --------- -------------------
12-MAY-00 23-FEB-15 2015-02-23:20:38:43

SQL>

it suppose to show in format there in "database_properties" table but its not showing like that.

and Connor said...

The output is based on your *session* settings that are nominated by the client, not the database.

For example:

SQL> create table t as select sysdate d from dual;

Table created.

SQL>
SQL> select * from t;

D
---------
22-AUG-17

1 row selected.

SQL>
SQL> alter session set nls_date_format = 'yyyy/mm/dd';

Session altered.

SQL>
SQL> select * from t;

D
----------
2017/08/22

1 row selected.

SQL>
SQL> alter session set nls_date_format = 'dd/mm/yyyy hh24:mi:ss';

Session altered.

SQL>
SQL> select * from t;

D
-------------------
22/08/2017 11:34:33

1 row selected.




Depending on the client program you are running, this might be set explicitly in the client software (eg SQL Developer), or be picked up from the operating system (eg environment variable on Unix, or registry setting in Windows).

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Timestamp format

Milind, August 22, 2017 - 8:12 am UTC

It seems that question is regarding format of timestamp column. If it so, then it's format will be decided by nls_timestamp_format parameter.


More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database