Home » SQL & PL/SQL » SQL & PL/SQL » Date Generation
Date Generation [message #216074] Wed, 24 January 2007 22:31 Go to next message
vamsi88
Messages: 6
Registered: January 2007
Junior Member
hi,

I need to "Generate Date and Time between two date ranges" ie
For Example if my start date is 12/Jan/2007 00:00:00 AM and end Date is 13/Jan /2007 00:00:00 PM. i need to generate
my output as

Date
----
12/Jan/2007 00:00:00
12/02/2007 00:01:01
12/03/2007 00:02:00
12/04/2007 00:03:00
12/05/2007
12/06/2007
12/07/2007
12/08/2007
.
.
.
so on till
13/Jan/2007


I need a record for every minute in the date range ir 24hrs or 1 day.

my output should be 1440 records(24* 60)


Thanks a ton in advance
Re: Date Generation [message #216075 is a reply to message #216074] Wed, 24 January 2007 22:54 Go to previous messageGo to next message
BlackSwan
Messages: 25046
Registered: January 2009
Location: SoCal
Senior Member
The homework tutor is down the hall 2nd door on the left.
Please show us what you've done & explain why it is wrong & how you plan on making it correct.
Re: Date Generation [message #216119 is a reply to message #216075] Thu, 25 January 2007 01:45 Go to previous messageGo to next message
Littlefoot
Messages: 20901
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Something like this?
SELECT TO_DATE(:v_start, 'dd.mm.yyyy') + LEVEL/24/60 result
FROM dual
CONNECT BY LEVEL < (TO_DATE(:v_end, 'dd.mm.yyyy') - TO_DATE(:v_start, 'dd.mm.yyyy')) * 24 * 60
Re: Date Generation [message #216123 is a reply to message #216119] Thu, 25 January 2007 02:16 Go to previous messageGo to next message
Maaher
Messages: 7062
Registered: December 2001
Senior Member
Check out the wiki.

MHE
Re: Date Generation [message #216662 is a reply to message #216119] Mon, 29 January 2007 19:12 Go to previous message
vamsi88
Messages: 6
Registered: January 2007
Junior Member
Thanks buddy....it worked
Previous Topic: Listing tables and their contents (merged)
Next Topic: Execute Immediate
Goto Forum:
  


Current Time: Thu Dec 08 16:27:39 CST 2016

Total time taken to generate the page: 0.23907 seconds