Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Oracle Newbie's Question

Oracle Newbie's Question

From: ss <sk_at_microsoft.com.us>
Date: Fri, 28 Jan 2005 21:49:35 +0800
Message-ID: <41fa42c9$1_3@rain.i-cable.com>


I am new to Oracle and confused by the difference between current_date and sysdate (well, the SQL Reference doesnt explain their difference at all)!!

My installation is Oracle 9i R2 and when the "dbtimezone" and
"sessiontimezone" are the same, the "current_date" and "sysdate" returns
different values (test1 below)?? I have to change the "sessiontimezone" to +8:0 in order to bring the two values the same(test2 below). I know
"current_date" should depends on my current session time zone. But what
about "sysdate"? Isn't it relative to "dbtimezone"? If not, what else is it relative to?
=============== test 1=============
SQL> ALTER SESSION SET TIME_ZONE='-7:0'; Session altered.

SQL> select dbtimezone,sessiontimezone,current_date,sysdate from dual;

DBTIMEZONE SESSIONTIMEZONE CURRENT_DATE SYSDATE

------------ -------------------- -------------------- --------------------
-07:00       -07:00               28-JAN-2005 06:31:24 28-JAN-2005 21:31:24

Session altered.

SQL> select dbtimezone,sessiontimezone,current_date,sysdate from dual;

DBTIMEZONE SESSIONTIMEZONE CURRENT_DATE SYSDATE

------------ -------------------- -------------------- --------------------
-07:00       +08:00               28-JAN-2005 21:31:25 28-JAN-2005 21:31:24
Received on Fri Jan 28 2005 - 07:49:35 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US