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

Home -> Community -> Usenet -> c.d.o.tools -> Re: Start date of a week in SQL

Re: Start date of a week in SQL

From: Scott Mattes <ScottMattes_at_yahoo.com>
Date: Thu, 01 Feb 2001 18:13:16 GMT
Message-ID: <0Hhe6.4214$c4.7809@skycache.prestige.net>

This

      select to_date( 43*7, 'ddd' ) from dual;

gives the correct day for the start, so

      select ( to_date( (43+1)*7, 'ddd' ) - 1 ) from dual;

gives the last day of the week. Substitue "to_char( sysdate, 'iw' )" or some such to fit your needs for the "43".

I guess that since IW is vague (not really, to me at least) Oracle decided to not allow it with to_date.

"Werner Hartmann" <whartmann_at_prs-gmbh.de> wrote in message news:3A798E0A.6C298D5F_at_prs-gmbh.de...
> I'm looking for a solution of my problem with week formating in SQL !
>
> Example:
> ---------
> select *
> from xyz
> where to_char (date, 'IW.YYYY') = '43.2000'
>
> This effects, no index on column date is used !
>
> Searched Solution :
> -------------------
> select *
> from xyz
> where date between <start date of week> and <end date of week>
>
> How can I get the start date and end date of a given week like '43.2000'
> ?
> I try it with to_date() function but formating with 'IW.YYYY' is not
> allowed.
>
> Thanks in advance
> Werner
>
Received on Thu Feb 01 2001 - 12:13:16 CST

Original text of this message

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