Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Location
    Haaksbergen, Netherlands
    Posts
    69

    Unanswered: Value of to_char(sysdate,'D') varies from PC where it runs on

    Hi,

    If I run

    SELECT SYSDATE as DTE, to_char(sysdate,'D') as DTT FROM DUAL

    the value of DTT depends on the local settings of the PC where your run the query on.
    Even if I put this statement in a view on the Oracle server.

    How can I create a weekday that has a constant value independent from the local settings from the PC where it runs from?

    Thanks,

    Wim Venema

  2. #2
    Join Date
    Jun 2004
    Location
    Haaksbergen, Netherlands
    Posts
    69
    see:

    http://www.adp-gmbh.ch/ora/sql/to_char.html

    Weekday (day of week)
    to_char(some_date,'D') returns a number indicating the weekday. However, for a given date, this number returned varies with NLS_TERRITORY:
    SQL> alter session set nls_territory='UNITED KINGDOM';

    Session altered.
    SQL> select to_char(sysdate,'D') from dual
    T
    -
    4
    SQL> alter session set nls_territory='AMERICA';

    Session altered.

    SQL> select to_char(sysdate,'D') from dual;
    T
    -
    5
    I executed these select statements on a thursday. So, in America, Thursday seems to be the 5th day in the week while it is the 4th in the UK.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •