User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Oracle section within the Web Development category of DaniWeb, a massive community of 423,751 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,315 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Oracle advertiser: Programming Forums
Views: 985 | Replies: 4
Reply
Join Date: Oct 2006
Posts: 34
Reputation: pointers is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
pointers pointers is offline Offline
Light Poster

Dates between the two given dates

  #1  
Apr 21st, 2008
Hi,

Can we get a SQL query, to display all the dates between two given dates
eg. if date1=21-mar-2007 and date2=25-mar-2007
then the query should display all the dates between those two given dates i.e
22-mar-2007, 22-mar-2007, 23-mar-2007and 24-mar-2007.

Query should not contain any plsql coding.

Regards.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2007
Location: Bangalore,India
Posts: 1,270
Reputation: debasisdas is on a distinguished road 
Rep Power: 4
Solved Threads: 80
debasisdas's Avatar
debasisdas debasisdas is offline Offline
Nearly a Posting Virtuoso

Re: Dates between the two given dates

  #2  
Apr 21st, 2008
You need to use BETWEEN clause .
Share your Knowledge.
Reply With Quote  
Join Date: Nov 2007
Posts: 51
Reputation: Nige Ridd is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 9
Nige Ridd Nige Ridd is offline Offline
Junior Poster in Training

Re: Dates between the two given dates

  #3  
Apr 22nd, 2008
You could try something like

  1. SELECT date1 + rownum
  2. FROM all_objects
  3. WHERE rownum < date2 - date1;

Nige
Last edited by peter_budo : Apr 23rd, 2008 at 7:00 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote  
Join Date: Oct 2006
Posts: 34
Reputation: pointers is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 1
pointers pointers is offline Offline
Light Poster

Re: Dates between the two given dates

  #4  
Apr 23rd, 2008
I tried but dint get.....if u can pls help me out...
Reply With Quote  
Join Date: Nov 2007
Posts: 51
Reputation: Nige Ridd is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 9
Nige Ridd Nige Ridd is offline Offline
Junior Poster in Training

Re: Dates between the two given dates

  #5  
Apr 23rd, 2008
How are you trying to run it? If you are using strings for the values of date1 & date2 then you'll have to put to_date() round each one as it uses the date arithmetic features in Oracle.
Nige
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Oracle Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Oracle Forum

All times are GMT -4. The time now is 1:44 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC