OCP-047 time_zone 参数

本文深入探讨了SQL中TIME_ZONE参数的使用,包括其语法、设置方法及常见值,如'os'、'local'、'时间偏移'、'dbtimezone'和特定地区名,帮助理解如何根据不同需求调整SQL会话的时间区。

137. Which three possible values can be set for the TIME_ZONE session
parameter by using the ALTER SESSION command? (Choose three.)
A. 'os'
B. local
C. '-8:00'
D. dbtimezone

E. 'Australia'


Answer: BCD


SQL> ALTER SESSION SET TIME_ZONE = local;
SQL> ALTER SESSION SET TIME_ZONE = dbtimezone;
SQL> ALTER SESSION SET TIME_ZONE = '+08:00';
SQL> ALTER SESSION SET TIME_ZONE = 'Europe/London';



TIME_ZONE

Syntax:

TIME_ZONE =  '[+ | -] hh:mm' 
             | LOCAL 
             | DBTIMEZONE 
             | 'time_zone_region'

The TIME_ZONE parameter specifies the default local time zone offset or region name for the current SQL session. TIME_ZONE is a session parameter only, not an initialization parameter. To determine the time zone of the current session, query the built-in function SESSIONTIMEZONE (see SESSIONTIMEZONE).

  • Specify a format mask ('[+|-]hh:mm') indicating the hours and minutes before or after UTC (Coordinated Universal Time--formerly Greenwich Mean Time). The valid range for hh:mm is -12:00 to +14:00.

  • Specify LOCAL to set the default local time zone offset of the current SQL session to the original default local time zone offset that was established when the current SQL session was started.

  • Specify DBTIMEZONE to set the current session time zone to match the value set for the database time zone. If you specify this setting, then theDBTIMEZONE function will return the database time zone as a UTC offset or a time zone region, depending on how the database time zone has been set.

  • Specify a valid time_zone_region. To see a listing of valid region names, query the TZNAME column of the V$TIMEZONE_NAMES dynamic performance view. If you specify this setting, then the SESSIONTIMEZONE function will return the region name.

Note:

Timezone region names are needed by the daylight savings feature. The region names are stored in two time zone files. The default time zone file is a small file containing only the most common time zones to maximize performance. If your time zone is not in the default file, then you will not have daylight savings support until you provide a path to the complete (larger) file by way of the  ORA_TZFILE environment variable.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值