日期:2014-05-16 浏览次数:20675 次
You can set the default session time zone with the ORA_SDTZ
environment variable. When users retrieve TIMESTAMP WITH LOCAL TIME ZONE
data, Oracle returns it in the users' session time zone. The session time zone also takes effect when a TIMESTAMP
value is converted to the TIMESTAMP WITH TIME ZONE
or TIMESTAMP WITH LOCAL TIME ZONE
datatype.
Note:
Setting the session time zone does not affect the value returned by theSYSDATE
and SYSTIMESTAMP
SQL function. SYSDATE
returns the date and time of the operating system on which the database resides, taking into account the time zone of the database server's operating system that was in effect when the database was started.The ORA_SDTZ
environment variable can be set to the following values:
Operating system local time zone ('OS_TZ'
)
Database time zone ('DB_TZ'
)
Absolute offset from UTC (for example, '-05:00'
)
Time zone region name (for example, 'Europe/London'
)
To set ORA_SDTZ
, use statements similar to one of the following in a UNIX environment (C shell):
% setenv ORA_SDTZ 'OS_TZ' % setenv ORA_SDTZ 'DB_TZ' % setenv ORA_SDTZ '-05:00' % setenv ORA_SDTZ 'Europe/London'
You can change the time zone for a specific SQL session with the SET TIME_ZONE
clause of the ALTER SESSION
statement.
TIME_ZONE
can be set to the following values:
Default local time zone when the session was started (local
)
Database time zone (dbtimezone
)
Absolute offset from UTC (for example, '+10:00'
)