Oracle 参数 NLS_TIMESTAMP_FORMAT 官方解释,作用,如何配置最优化建议
本站中文解释
NLS_TIMESTAMP_FORMAT参数定义Oracle默认的时间戳格式,使用指定的格式在系统上向客户端传送与时间戳有关的信息,例如查询SELECT文中,把查询结果转换成单独的时间戳值,召回与时间戳有关的信息时。
正确设置NLS_TIMESTAMP_FORMAT的方法,首先需要确定用户的定义及操作系统的当前地点,IDE工具,客户端应用程序等,确定表示时间和时间戳的本地要求;然后依据要求的格式,使用Oracle支持的格式,在SQL中指定要使用的时间戳格式;最后在Oracle中实际设置NLS_TIMESTAMP_FORMAT参数,可以使用ALTER SESSION语句或者ALTER SYSTEM语句,例如:alter system set nls_timestamp_format=’yyyy-mm-dd hh24:mi:ss’;
官方英文解释
NLS_TIMESTAMP_FORMAT
defines the default timestamp format to use with the TO_CHAR
and TO_TIMESTAMP
functions.
Property | Description |
---|---|
Parameter type |
String |
Syntax |
|
Default value |
Derived from |
Modifiable |
|
Modifiable in a PDB |
Yes |
Range of values |
Any valid datetime format mask |
Basic |
No |
The value must be surrounded by quotation marks as follows:
NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH:MI:SS.FF'
You can specify the value of NLS_TIMESTAMP_FORMAT
by setting it in the initialization parameter file. You can specify its value for a client as a client environment variable.
You can also alter the value of NLS_TIMESTAMP_FORMAT
by changing its value in the initialization parameter and then restarting the instance. To alter the value during a session use the ALTER SESSION SET
statement.
Note:
The value of this initialization parameter NLS_TIMESTAMP_FORMAT
is used to initialize the session value of this parameter, which is the actual value referenced by the SQL query processing. This initial value is overridden by a client-side value if the client uses the Oracle JDBC driver or if the client is OCI-based and the NLS_LANG
client setting (environment variable) is defined. The initialization parameter value is, therefore, usually ignored.
See Also:
Oracle Database
Globalization Support Guide for more information about this parameter