INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Date series generation using pure SELECT - SQL?

Date series generation using pure SELECT - SQL?

(OP)
Hello all,

Can a record containing a beginning covered date of say, 2015-06-01 and an ending covered date of 2015-06-05 be generated to become five (5) separate records having individual date of the covered dates using pure SELECT - SQL only? If so, how?

TIA

kilroy knight
philippines

"Once a king, always a king. But being a knight is more than enough."

RE: Date series generation using pure SELECT - SQL?

2
try this

with dtes as
(
select end_date - start_date diff ,start_date
from
(
select to_date('30-apr-15') end_date, to_date('01-jan-15') start_date
from dual
)
)
SELECT dtes.start_date + LEVEL the_dte
FROM dual,dtes
CONNECT BY LEVEL <= dtes.diff
/

In order to understand recursion, you must first understand recursion.

RE: Date series generation using pure SELECT - SQL?

@taupirho,

I like it!

@kilroy,

"Once a king, always a king. But being a knight is more than enough."
This may be an instance where meaning is lost in interpreataion.

This PUN is best understood spoken rather than written as night and knight are pronounced the same...
"Once a king, always a king. But once a night is enough."

This kind of pun is similar in structure to...
"Time flies like an arrow. Fruit flys like a banana."

But in both cases the category of relation switches, resulting in the an irony of a pun, a play on words.

"King" relates to "knight" but switches to "night".
"Time flies like" relates to "Fruit flys like," but the fleeting time category of similarity to an arrow switches to a Fruit fly that is not fleeting but attracted to a banana.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Date series generation using pure SELECT - SQL?

1 select to_date('06012015','mmddyyyy') + (rownum - 1) the_dt
2 from all_objects
3 where rownum < 6
4* order by 1
>/

THE_DT
---------
01-JUN-15
02-JUN-15
03-JUN-15
04-JUN-15
05-JUN-15

Bill
Lead Application Developer
New York State, USA

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close