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

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

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 6th, 2011, 06:22 AM
matt755921 matt755921 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2011
Posts: 1 matt755921 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 26 sec
Reputation Power: 0
Fill the gaps of multiple ranges by date

Hi,
I have a table of data that gives me a start and end value by date. I need to return all values per day within the range:

eg: my table consists of
MY_RANGE_START_OR_END_NB,SYS_DATE,MY_RANGE_STATUS
1421,12/09/2011 00:00:00,RANGE_END
1418,12/09/2011 00:00:00,RANGE_START
1401,11/09/2011 00:00:00,RANGE_END
1400,11/09/2011 00:00:00,RANGE_START
1390,10/09/2011 00:00:00,RANGE_END
1389,10/09/2011 00:00:00,RANGE_START

my result set should return:
1389, 10/09/2011
1390, 10/09/2011
1400, 11/09/2011
1401, 11/09/2011
1418, 12/09/2011
1419, 12/09/2011
1420, 12/09/2011
1421, 12/09/2011

my current attempt only returns for a single date:
select (select MY_RANGE_START_OR_END_NB from (select table1.MY_RANGE_START_OR_END_NB, table1.SYS_DATE
from TABLE_ONE table1
where table1.MY_RANGE_STATUS = 'RANGE_START'
)) + (level -1)
-- and table1.SYS_DATE like to_date('20110909','YYYYMMDD'))) + (level -1)
from DUAL
connect by level <= (
select t1.MY_RANGE_START_OR_END_NB - t2.MY_RANGE_START_OR_END_NB
from
(select table1.MY_RANGE_START_OR_END_NB, table1.SYS_DATE
from TABLE_ONE table1
where table1.MY_RANGE_STATUS = 'RANGE_END'
) t1,
-- and table1.SYS_DATE like to_date('20110909','YYYYMMDD')) t1,
(select table1.MY_RANGE_START_OR_END_NB, table1.SYS_DATE
from TABLE_ONE table1
where table1.MY_RANGE_STATUS = 'RANGE_START'
) t2
-- and table1.SYS_DATE like to_date('20110909','YYYYMMDD')) t2
)


I know I am missing something....??

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > Fill the gaps of multiple ranges by date

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap