Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2005
    Posts
    8

    Unanswered: Help: Oracle equivalent for SQL Server's @@DATEFIRST fn

    Hi,

    Is there any equivalent in Oracle for SQL Server's @@DATEFIRST fn??

    Where @@DATEFIRST Returns the current value of the SET DATEFIRST parameter, which indicates the specified first day of each week: 1 for Monday, 3 for Wednesday, and so on through 7 for Sunday.
    Any help is appreciated ..

  2. #2
    Join Date
    May 2004
    Location
    Dominican Republic
    Posts
    721
    to_char( <date field>, 'D' ) could be its equivalent, allthough you can change the behaivour of @@DATEFIRST in SQL Server if you use SET DATEFIRST (as you described), you cannot do that in Oracle.

  3. #3
    Join Date
    Aug 2004
    Location
    France
    Posts
    754
    Be aware that the 'D' format depends on NLS_TERRITORY, for example :

    Code:
    rbaraer@Ora10g> alter session set nls_territory='FRANCE';
    
    Session altered.
    
    rbaraer@Ora10g> select to_char(sysdate,'D'), to_char(sysdate, 'DAY') from dual;
    
    T TO_CHAR(SYSDATE,'DAY')
    - ---------------------------
    4 THURSDAY
    
    rbaraer@Ora10g> alter session set nls_territory='AMERICA';
    
    Session altered.
    
    rbaraer@Ora10g> select to_char(sysdate,'D'), to_char(sysdate, 'DAY') from dual;
    
    T TO_CHAR(SYSDATE,'DAY')
    - ---------------------------
    5 THURSDAY
    
    rbaraer@Ora10g>
    HTH & Regards,

    rbaraer
    ORA-000TK : No bind variable detected... Shared Pool Alert code 5 - Nuclear query ready .

  4. #4
    Join Date
    May 2004
    Location
    Dominican Republic
    Posts
    721
    Excellent RBARAER. I couldn't think of that.

Posting Permissions

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