Re: Strange (?) behaviour with SYSTIMESTAMP

From: Andy Klock <andy_at_oracledepot.com>
Date: Tue, 26 Oct 2010 16:15:33 -0400
Message-ID: <AANLkTi=SYvqFUyLz-a7mSesRJtuWfuA_Qn8cagMvnC1a_at_mail.gmail.com>



When you cast to a timestamp, you have to explicitly tell it to include the time zone:

andy_at_TEST>select systimestamp - cast(systimestamp as timestamp with time zone) from dual;

SYSTIMESTAMP-CAST(SYSTIMESTAMPASTIMESTAMPWITHTIMEZONE)



+000000000 00:00:00.000000

On Tue, Oct 26, 2010 at 3:59 PM, Steve Baldwin <stbaldwin_at_multiservice.com>wrote:

> Does this strike anyone as weird ?
>
> SQL> select sessiontimezone from dual;
>
> SESSIONTIMEZONE
>
> --------------------------------------------------------------------------------
> +11:00
>
> SQL> select systimestamp - cast(systimestamp as timestamp) from dual;
>
> SYSTIMESTAMP-CAST(SYSTIMESTAMPASTIMESTAMP)
> ---------------------------------------------------------------------------
> +000000000 00:00:00.000000
>
> SQL> alter session set time_zone = '+10:00';
>
> Session altered.
>
> SQL> select systimestamp - cast(systimestamp as timestamp) from dual;
>
> SYSTIMESTAMP-CAST(SYSTIMESTAMPASTIMESTAMP)
> ---------------------------------------------------------------------------
> -000000000 01:00:00.000000
>
> Steve
>
> On Tue, Oct 26, 2010 at 9:44 PM, Peter Hitchman <pjhoraclel_at_gmail.com>
> wrote:
> > Hi,
> > What about using localtimestamp instead?
> >
> > Regards
> > Pete
> > --
> > http://www.freelists.org/webpage/oracle-l
> >
> >
> >
>
>
> ---------------------------------------------------------------------------------------
> This email is intended solely for the use of the addressee and may
> contain information that is confidential, proprietary, or both.
> If you receive this email in error please immediately notify the
> sender and delete the email.
>
> ---------------------------------------------------------------------------------------
>
> --
> http://www.freelists.org/webpage/oracle-l
>
>
>

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Oct 26 2010 - 15:15:33 CDT

Original text of this message