Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 20th, 2004, 01:24 PM
hudo hudo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 97 hudo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 23 m 19 sec
Reputation Power: 6
select entries from whole week

Hello,

I'd like to get all entries from "the whole week" (begin: Monday end: Sunday)
from e.g the day sysdate - 222 (today: 20.10.2004) .This means all entries with a date between 08.03.2004
and 14.03.2004 (including the borders !)

Reply With Quote
  #2  
Old October 21st, 2004, 09:19 AM
hedge hedge is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Apr 2002
Posts: 692 hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level)hedge User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 4 Days 23 h 15 m 53 sec
Reputation Power: 19
I think you can use trunc(date,'day') here. you have to be careful because it returns a different date depending on your nls settings.

for me
Code:
select trunc(sysdate,'day') from dual;


returns the 17th which is sunday so I'd use a query like this

Code:
select * from table
where table.date >= trunc(sysdate,'day')+1
   and table.date <= trunc(sysdate,'day')+7


you might also want to try the trunc format 'IW' which Oracle says is: Same day of the week as the first day of the ISO year. ... for me that returns monday.

Last edited by hedge : October 21st, 2004 at 09:25 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > select entries from whole week


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT