Question

I have the following query. It returns the current time in different regions. It works fine for most of the regions which are in the table V@timezone_names. But this query returns the wrong result for:

  1. 'Asia/Tehran' with +4:30 time zone differences
  2. 'America/Caracas' with -4:30 time zone differences

My query is:

select CAST(FROM_TZ( CAST(current_date AS TIMESTAMP)
                   , sessiontimezone)
             AT TIME ZONE 'America/Caracas' AS DATE) 
  from dual;

You can see the current time in different countries-cities here.

Was it helpful?

Solution

Oracle issues timezone file patches from time to time to correct bugs and for changes introduced by countries and territories changing the rules for their timezones. Oracle support note 412160.1 shows how you can check which timezone file you have, and how to update. (The check is simple in 10g - SELECT version FROM v$timezone_file).

Under 11g with timezone file version 14, I get -4:30 for Caracas and +4:30 for Tehran, displaying times matching the site you linked to.

Looks like Caracas changed its timezone in late 2007, so I guess you're showing -4:00; and Tehran had DST changes in 2008 (or reintroduced DST, not sure), so I guess you're showing +3:30. It seems reasonable to assume that your current timezone predates those changes; by default 10g will be on v3 or v4.

I'd suggest you update to the latest timezone file (version 18); you'll need to look at that support note to see how to do it for your circumstances, or more specifically note 1448706.1, 'Applying the DSTv18 update for the Oracle Database'. You can get it as patch 13417321. If you still find a problem when using the latest patch then you can raise a service request with Oracle to get it fixed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top