Re: Strange (?) behaviour with SYSTIMESTAMP

  • From: Andy Klock <andy@xxxxxxxxxxxxxxx>
  • To: stbaldwin@xxxxxxxxxxxxxxxx
  • Date: Tue, 26 Oct 2010 16:15:33 -0400

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

andy@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@xxxxxxxxxxxxxxxx>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@xxxxxxxxx>
> wrote:
> > Hi,
> > What about using localtimestamp instead?
> >
> > Regards
> > Pete
> > --
> > //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.
>
> ---------------------------------------------------------------------------------------
>
> --
> //www.freelists.org/webpage/oracle-l
>
>
>

Other related posts: