sys_extract_utc, sysdate and cast to timestamp
PauloSMOMay 14 2013 — edited May 15 2013I have a question about sys_extract_utc.
According to this document:
http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions167.htm
SYS_EXTRACT_UTC function entry is a datetime_with_timezone.
so... running this in my system:
1) select TO_CHAR(SYSDATE, 'YYYY-MM-DD HH24:MI') as mysysdate from dual;
MYSYSDATE
----------------
2013-05-14 20:27
2) select TO_CHAR(systimestamp, 'YYYY-MM-DD HH24:MI TZR') as mysystimestamp from dual;
MYSYSTIMESTAMP
-------------------------------------------------
2013-05-14 20:27 +03:00
3) select TO_CHAR((cast (sysdate as timestamp)), 'YYYY-MM-DD HH24:MI TZR') as cast_sysdate_timestamp from dual;
CAST_SYSDATE_TIMESTAMP
-------------------------------------------------
2013-05-14 20:17 +00:00
4) select TO_CHAR(sys_extract_utc(cast (sysdate as timestamp)), 'YYYY-MM-DD HH24:MI TZR') as utc_time from dual;
UTC_TIME
-------------------------------------------------
2013-05-14 17:27 +00:00
Questions:
How is it possible to have the query 4) correct... if the cast of sysdate to timestamp in 3) does not have the correct timezone has you can see in query 3) !?
Where does sys_extract_utc collects the information, in order to make query 4) correct?
Edited by: PauloSMO on 14/Mai/2013 10:37