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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Simple Query for Week number

RE: Simple Query for Week number

From: <Rajesh.Rao_at_jpmchase.com>
Date: Thu, 19 Dec 2002 09:59:30 -0800
Message-ID: <F001.0051E980.20021219095930@fatcity.com>

Dan, Thanks. The "W" works just fine. What I was looking for.

Phew!!! I almost wrote a PL/SQL for this ;))))

                                                                                                                    
                    "Fink, Dan"                                                                                     
                    <Dan.Fink_at_mdx        To:     Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>        
                    .com>                cc:                                                                        
                    Sent by:             Subject:     RE: Simple Query for Week number                              
                    root_at_fatcity.                                                                                   
                    com                                                                                             
                                                                                                                    
                                                                                                                    
                    December 19,                                                                                    
                    2002 12:05 PM                                                                                   
                    Please                                                                                          
                    respond to                                                                                      
                    ORACLE-L                                                                                        
                                                                                                                    
                                                                                                                    




Raj,
           How do you define week number? If a month starts in the middle
of
the week, is that week #1 or must it be the first full week?

           If the format mask 'W' is adequate, use

  1 select sysdate, to_char(sysdate, 'W'),

  2         '01-DEC-02', to_char(to_date('01-DEC-02'), 'W'),
  3         '30-NOV-02', to_char(to_date('30-NOV-02'), 'W')
  4* from dual
SQL> / SYSDATE T '01-DEC-0 T '30-NOV-0 T
--------- - --------- - --------- -

19-DEC-02 3 01-DEC-02 1 30-NOV-02 5
-----Original Message-----

Sent: Thursday, December 19, 2002 8:54 AM To: Multiple recipients of list ORACLE-L

Hey Folks,

Looking for the simplest of queries to find the week number, given a date. For example, 19th December 2002 falls in the 3rd week, whereas 19th November, 2002, falls in the 4th week.

Thanks
Raj

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author:
  INET: Rajesh.Rao_at_jpmchase.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services

---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).
--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author: Fink, Dan
  INET: Dan.Fink_at_mdx.com
Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services

---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).

--

Please see the official ORACLE-L FAQ: http://www.orafaq.net
--

Author:
  INET: Rajesh.Rao_at_jpmchase.com

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services

---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Thu Dec 19 2002 - 11:59:30 CST

Original text of this message

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