Query to retrieve next valid record

Hi All
I have a strange requirement to write a query/logic to achieve the following. I have a table which has a date column and a field which signifies whether it is a valid date or not
Date Valid
11/01/2010 Y
12/01/2010 N
13/01/2010 N
17/02/2010 Y
15/03/2010 N
11/04/2010 Y
21/06/2010 Y
18/08/2010 N
14/09/2010 N
17/10/2010 Y
If a particular date is not valid, I need to output the next valid date. So someting like
Date Valid     Valid date
11/01/2010 Y          11/01/2010
12/01/2010 N          17/02/2010
13/01/2010 N          17/02/2010
17/02/2010 Y          17/02/2010
15/03/2010 N          11/04/2010
11/04/2010 Y          11/04/2010
21/06/2010 Y          21/06/2010
18/08/2010 N          17/10/2010
14/09/2010 N          17/10/2010
17/10/2010 Y          17/10/2010
Is this possible in one single query ?
Thanks
Birdy

with t as (
           select to_date('11/01/2010','dd/mm/yyyy') dt,'Y' valid from dual union all
           select to_date('12/01/2010','dd/mm/yyyy'),'N' from dual union all
           select to_date('13/01/2010','dd/mm/yyyy'),'N' from dual union all
           select to_date('17/02/2010','dd/mm/yyyy'),'Y' from dual union all
           select to_date('15/03/2010','dd/mm/yyyy'),'N' from dual union all
           select to_date('11/04/2010','dd/mm/yyyy'),'Y' from dual union all
           select to_date('21/06/2010','dd/mm/yyyy'),'Y' from dual union all
           select to_date('18/08/2010','dd/mm/yyyy'),'N' from dual union all
           select to_date('14/09/2010','dd/mm/yyyy'),'N' from dual union all
           select to_date('17/10/2010','dd/mm/yyyy'),'Y' from dual
select  dt,
        valid,
        min(
            case valid
              when 'Y' then dt
            end
           ) over(order by dt rows between current row and unbounded following) valid_dt
  from  t
  order by dt
DT         V VALID_DT
11/01/2010 Y 11/01/2010
12/01/2010 N 17/02/2010
13/01/2010 N 17/02/2010
17/02/2010 Y 17/02/2010
15/03/2010 N 11/04/2010
11/04/2010 Y 11/04/2010
21/06/2010 Y 21/06/2010
18/08/2010 N 17/10/2010
14/09/2010 N 17/10/2010
17/10/2010 Y 17/10/2010
10 rows selected.
SQL> SY.

Similar Messages

  • SQL Query to retrieve the All records based on the Max Dates.

    Hello all,
    I am trying to retrieve the newest record based on the date field (  nextDate  ).
    Currently there are only 4 records in the MC_Maintenance table and two in the Machine table.
    Machine table
    MC_id             EquipID          
    1                      0227
    MC_id             EquipID
    2                     0228
    MC_Maintenance table
    Maint_id           MC_id             Next_maint                  
    1                      2                      08/25/2010     
    2                      2                      07/01/2010
    3                      1                      06/11/2010
    4                      1                      07/11/2010
    What I  am trying to accomplish is,
    list the two machines from the Machine table with the MAX(Next_maint) controlling the MC_Maintenance output list
    These are the records that I would like to Display.
    Maint_id           MC_id             Next_maint                  
    1                      2                      08/25/2010
    4                      1                      07/11/2010                 
    Below is the SQL Query
    SELECT
           MC.MC_ID as ID,
            MC.complete_Date as completed,
            MC.next_maint as nextDate,
            MC.maint_notes as Notes,
            MC.facility as Facility,
            M.EquipId,
            M.name as name,
            M.SerialNumber as SN,
            M.dept as dept,
            M.Freq as freq
            From  MC_Maintenance MC, Machine M
            where  MC.MC_ID =  M.MC_ID
    '           USING MAX(nextDate )
    Any ideas would help.
    TJ

    I would have thought that was a simple group by problem?
    SELECT M.EquipID, MC.MC_ID, Max(MC.next_maint)
    FROM MC_Maintenance MC INNER JOIN Machine M ON MC.MC_ID = M.MC_ID
    GROUP BY M.EquipID, MC.MC_ID

  • Query to retrieve the records which have more than one assignment_id

    Hello,
    I am trying to write a query to retrieve all the records from the table per_all_assignments_f which has more than one different assignment_id for each person_id. Below is the query i have written but this retrieves the records even if a person_id has duplicate assignment_id's but i need records which have more than one assignement_id with no duplicates for each person_id
    select assignment_id ,person_id, assignment_id
    From per_all_assignments_f
    having count(assignment_id) >1
    group by person_id, assignment_id
    Thank You.
    PK

    Maybe something like this?
    select *
    From   per_all_assignments_f f1
    where  exists (select 1
                   from   per_all_assignments_f f2
                   where  f2.person_id = f1.person_id
                   and    f2.assignment_id != f1.assignment_id
                  );Edited by: SomeoneElse on May 7, 2010 2:23 PM
    (you can add a DISTINCT to the outer query if you need to)

  • Analytic query to select next record

    Hi all,
    I would like to query the below two table match to ouput.
    1.dev_wt 2.dev_map 3.Output Result
    To help more clearance please see this image link : http://lh6.ggpht.com/_xL6eBqjW6Yo/TEqnSvlF_FI/AAAAAAAAB0U/i2sclnnaj6g/Untitled-3.jpg
    1. dev_wt
    PMS_COMP     PMS_I       PMS_PERF_D   PMS_WT   PMS_CREATION_D
    BBOARD     GICEQGROSS    04/01/2001     30     04/05/2001
    BBOARD     GICST_B       04/01/2001     5      04/05/2001
    BBOARD     SBGS_B        04/01/2001     65     04/05/2001
    BBOARD     GICEQGROSS    04/11/2001     30     04/15/2001
    BBOARD     GICST_B       04/11/2001     5      04/15/2001
    BBOARD     SBGS_B        04/11/2001     65     04/15/20012. dev_map
    GS_CODE     GS_I_CODE    GS_I_ID  MD_ID   GS_START_DT    GS_END_DT
    GICEQGROSS   CIWL        304       15     01/04/1998     31/03/2004
    GICEQGROSS   CIWL        304       2     01/04/2004      31/03/9998
    GICST_B      GICST_B     3707      15     01/04/2000     31/12/9998
    SBGS_B       SBGS_B      2231      15     01/04/1992     30/09/2003
    SBGS_B       SBGS_B      564       15     01/10/2003     31/12/9998I would like to match PMS_I = GS_CODE to retrieve GS_I_CODE and using analytic
    query to find next record.
    Because I need to select GICEQGROSS record of PMS_PERF_D date and next
    GICEQGROSS record of PMS_PERF_D from dev_wt table and put GS_WT_FR and GS_WT_TO of Output result.
    ***Date is change to YYYYMMDD format
    ***PMS_WT is devided by 100
    *3. Output Result*
    GS_I_ID    PMS_COMP     GS_I_CODE     GS_WT_FR     GS_WT_TO     GS_I_CALC
    304       BBOARD        CIWL          20010401     20010410     0.3
    3707      BBOARD        GICST_B       20010401     20010410     0.05
    5209      BBOARD        SBGS_B        20010401     20010410     0.65PMS_COMP is from dev_wt table
    GS_I_CODE is from dev_map table join with dev_wt
    GS_WT_FR is from dev_wt table of GS_START_DT
    GS_WT_TO is from dev_wt table of next record GS_START_DT where PMS_I ='GICEQGROSS'
    Now my difficulty is to select next record of PMS_PERF_D using analytic query. Below
    is my query...
    SELECT GS_I_ID, PMS_COMP, GS_I_CODE, GS_WT_FR, GS_WT_TO, GS_I_CALC
    FROM dev_wt (
    SELECT lead(PMS_PERF_D) over(partition by PMS_I order by PMS_PERF_D) as GS_WT_TO       
    FROM dev_wt where PMS_I ='GICEQGROSS')
    left join dev_map on PMS_I = GS_CODE ;Thanks
    Edited by: WinZone on Jul 24, 2010 4:46 PM
    Edited by: WinZone on Jul 24, 2010 4:50 PM

    Hi,
    This query should be fine:
    SELECT DISTINCT t2.gs_i_id, pms_comp, t2.gs_i_code,
                    TO_CHAR
                       (MIN (pms_perf_d) OVER (PARTITION BY pms_comp, pms_i),
                        'yyyymmdd'
                       ) gs_wt_fr,
                    TO_CHAR
                       (MAX (pms_perf_d) OVER (PARTITION BY pms_comp, pms_i) - 1,
                        'yyyymmdd'
                       ) gs_wt_to,
                    pms_wt / 100 gs_i_calc
               FROM dev_wt t1, dev_map t2
              WHERE t2.gs_code = t1.pms_iREM Same remark as odie: should be "2231" instead ...

  • How to retrieve the duplicates records.

    Hi friends,
         My next issue, how to retrieve the duplicate records in web intelligence.I checked the option Retrieve duplicate records in web intelligence as well.But it is not helping me.
    Hope you guys are help to solve this issue.
    Thanks lot,
    Regards,
    -B-

    hi Blaji,,
    ive tried this here and it worked perfectly with me
    even so, you dont need to make the QTY as a dimension, you can leave it as a measure also, and it will work good with you.
    click the block on the WebI, the Block itself.
    and find its properties, under "Display", you will find
    "Avoid Duplicate row Aggregations"
    in the query it self you should flag "Retrieve Duplicated Rows"
    i think this will work fine with you
    good luck
    Amr

  • Mixing next n records with cfswitch order by problem

    Hello;
    I'm trying to make 2 types of page navigation work together. both work fine independently, but when I put my next n record code together with my change order by code, when you hit the next button, it goes back to the set default for the order by. I know I need to change some code logic in my scripts that run the next n records, but I'm not sure what I need to change in it to make it all work together properly. I am attaching the code, in it's rawest form, but all code is here for both features.
    <cfparam name="sort" default="1">
    <cfquery name="getMerch" datasource="#APPLICATION.dataSource#">
    SELECT merchID, MerchName, MerchDescription, MerchPrice, MYFile, CategoryID
    FROM Merchandise
    WHERE CategoryID = 2
    ORDER BY
    <cfswitch expression="#sort#">
    <cfcase value="1">MerchName</cfcase>
    <cfcase value="2">MerchPrice</cfcase>
    </cfswitch>
    </cfquery>
    <cfset rowsPerPage = 3>
    <cfparam name="URL.startRow" default="1" type="numeric">
    <cfset totalRows = getMerch.recordCount>
    <cfset endRow = min(URL.startRow + rowsPerPage - 1, totalRows)>
    <cfset startRowNext = endRow + 1>
    <cfset startRowBack = URL.startRow - rowsPerPage>
    <cfoutput>
    <!--- changes the order by --->
    <cfif sort is 1>
    <a href="#CGI.script_name#?sort=#IIF(sort is 1, '2', '1')#" class="pre2Nav">Order By Price</a>
    <cfelse>
    <a href="#CGI.script_name#?sort=#IIF(sort is 2, '1', '2')#" class="pre2Nav">Order By Product</a>
    </cfif>
    <!--- my next n buttons --->
    <cfif startRowBack GT 0>
    <a href="#CGI.script_name#?startRow=#startRowBack#" class="pre2Nav">< Back</a>
    </cfif>
    <cfif startRowNext lte totalRows>
    <a href="#CGI.script_name#?startRow=#startRowNext#" class="pre2Nav">More ></a>
    </cfif>
    </cfoutput>
    <cfloop query="getMerch" startRow="#URL.startRow#" endRow="#endRow#">
    <cfoutput>
    All my output goes here
    </cfoutput></cfloop>
    Can anyone help me get this to work together? is it possible? and more importantly, how hard is it going to be to do this?
    Thank you.

    if I use this:
    <cfdump var = "#isDefined('sort')#">
    I get YES as the output, even when I hit the next button and change the category.
    If I use this:
    <cfdump var = "isDefined('sort')>
    all I get is this:
    isDefined('sort')

  • SQL query to get last 10 records in the table?

    Hi,
    Can anyone tell me the SQL query to get last 10 records in the table?
    Thanks!!
    MCP

    Please, define what "last" means. Sets are unordered by definition, so if you want to retrieve rows from a table in a specific order you need to specify what that order is - e.g. by maintaining a value in a column (or a combination of columns) that you can use in the ORDER BY clause of the SELECT statement.
    If, for instance, you kept the time when the row was inserted in a special column (InsertedTime), you could use this in your query like this:
    select top (10)
      <column list>
      from <table or view>
      where <restriction(s)>
      order by InsertedTime desc;
    ML
    Matija Lah, SQL Server MVP
    http://milambda.blogspot.com

  • SPSecurityContext.WindowsIdentity: Could not retrieve a valid windows identity. No windows identity for domain\user.

    Hi,
    We get plenty of error messages:
    SPSecurityContext.WindowsIdentity: Could not retrieve a valid windows identity.
    No windows identity for domain\user.
    Our SharePoint 2010 environment consists of 2 app and 2 front end servers. We have plenty of SPSecurityContext.WindowsIdentity errors in our SharePoint logs. I found that this is related to C2WTS service. We have this service running under Local System account
    and only running on both Front-end servers. We are not using Kerberos in our environment.
    My question is should this service be configured with domain account even we are not using Kerberos?
    Also should this server be started on App sharepoint servers?
    Is any other way to prevent those errors?
    Thank you,

    Since local accounts are unable to query the domain, and I suspect that the Local System account uses a virtual local account (as opposed to the computer's domain account), then the same would apply to your C2WTS.
    Yes, configure a domain account (DEDICATED, since C2WTS requires some VERY elevated privileges), and the C2WTS will be able to do all of its domain lookups.
    Scott Brickey
    MCTS, MCPD, MCITP
    www.sbrickey.com
    Strategic Data Systems - for all your SharePoint needs

  • Query to retrieve data from action infotype based on particular actiontype

    Hi folks,
    I need some help in retrieving data from infotype 0000.
    The records for a certain employee id (10035532) for action infotype are as follows.. I trying to retireve the LOA action records
       BEGDA-ENDDA-MASSN-MASSG
    1. 04/01/2008 - 12/31/9999 - Z7(RLOA) - 02(FMLA).
    2. 03/01/2008 - 03/31/2008 - ZB - 03.
    3. 02/10/2008 - 02/29/2008 - Z2 - 05
    4. 01/20/2008 - 02/09/2008  - ZB - 07
    5  01/05/2008 - 01/19/2008  - Z5(Paid LOA) - 05(FMLA)
    I have to retrieve the Z5 record for this employee. For every Z7 there is a corresponding Z5 record that links to the LOA records, in most cases the Z5 is immediately followed by Z7 record. I am able to retrieve such records successfully. However for few employees like one here the Z5 record is the fourth or fifth record down from the Z7. How can i retrieve the record in such a case?
    Also in some cases the date ranges are missing in between, in such cases can we retirieve data succesfully? For ex:
    1. 04/01/2008 - 12/31/9999 - Z7(RLOA) - 02(FMLA).
    2. 03/01/2008 - 03/31/2008 - ZB - 03.
    3. 02/10/2008 -                   - Z2 - 05
    4. 01/20/2008 -                   - ZB - 07
    5  *01/05/2008 - 01/19/2008  - Z5(Paid LOA) - 05(FMLA)
    Need some inputs on the query here.
    Thanks in advance,
    VG

    No responses. The thread is closed.
    VG

  • Query to retrieve all unreconciled BP account transactions

    Hi, can anyone help me to formulate a SQL query to retrieve only the unreconciled transactions from a business partner account.  In other words all the records that display in the account balance enquiry when you tick the "Display Unreconciled Trans. Only" box.

    Hi all,
    No one has been able to help with this one.  It appears to me there should be a simple solution somewhere.  Can anyone be a hero and answer this?
    I am querying the JDT1 table to get the transactions but I get everything and I want to identify only the ones that have not yet been reconciled.
    Cheers,
    Greg.

  • Need efficient SQL query to retrieve data for MLM website

    Table cd_members
    MemberID LeftID RightID
    1 2 3
    2 4 5
    3 6 7
    4 8 -
    5 - -
    6 - -
    7 - -
    8 9 10
    9 - -
    10 - -
    i want to execute a query to retrieve downline of a member say MemberID 2
    o/p should be Records with MemberID 4,5,8,9,10
    i am using this query but don't know how to start from MembeID=2
    select a.memberid, a.tradingid, a.refid, a.parentid, a.node, a.leftid, a.rightid, b.memberid from cd_members a, cd_members b
    where (a.leftid=b.memberid or a.rightid=b.memberid)

    Again, assuming that the number of levels is known, you can just do N self joins (note that I intentionally go one level further than necessary in this case
    SQL> ed
    Wrote file afiedt.buf
      1  with t
      2    as
      3   (
      4      select 1 person, 2 left, 3 right from dual union all
      5      select 2, 4, 5 from dual union all
      6      select 3, 6, 7 from dual union all
      7      select 4, 8, null from dual union all
      8      select 5, null, null from dual union all
      9      select 6, null, null from dual union all
    10      select 7, null, null from dual union all
    11      select 8, 9, 10 from dual union all
    12      select 9, null, null from dual union all
    13      select 10, null, null from dual
    14   )
    15   select t1.left, t1.right, t2.left, t2.right, t3.left, t3.right, t4.left, t
    4.right
    16     from t t1,
    17          t t2,
    18          t t3,
    19          t t4
    20    where t1.person = 2
    21      and t1.left = t2.person(+)
    22      and t2.left = t3.person(+)
    23*     and t3.left = t4.person(+)
    SQL> /
          LEFT      RIGHT       LEFT      RIGHT       LEFT      RIGHT       LEFT
         RIGHT
             4          5          8                     9         10Justin

  • Is there an easy way to fetch next/previous record in Apex?

    I am new to APEX/Oracle, but have a lot of expierence as a mainframe programmer and some experience with SQL.
    I have been tasked by my boss to create a set of pages in an application as follows.
    Page 1: Select an Employees Name and go to Page 2.
    Page 2: Display Employee's Biography Information.
    Add a "Next Employee" button and a "Previous Employee" button that will fetch the next/previous Employees Biography info respectively.
    In essence, he wants a query with every employee's biography information with the employee selected on page 1 used as the starting pointer.
    I have successfully built "select an Employee's name on page 1" and "display his/her info on page 2" with a query that returns a single record.
    What I can not figure out is how to get a next and previous button to get the next or previous record in a multi record query, using the intially selcted employee as the intial pointer.
    Is their an easy way to build this using built-in APEX functionailty, or will it require programming to achieve this requirement?

    Bob,
    I installed the Aria application, but now I wish I'd run the preview first. It's a cool application, but I don't see anything like what greich requested. I'm looking for the same thing.
    <ol>
    <li>     and clicked the Edit or View Details button for an individual. </li>
    <li>That takes me to a custom Form page that shows one person. </li>
    </ol>
    I'm trying to imagine how I'd code buttons for that Form page to let me click to see the next or previous person on that same form. My mind gets totally boggled when I consider that the user might have filtered the report to only show a few records. How do I have any idea what those IDs were and what order they were showing in, to know which is the next individual.
    My only thought it to create a process on the report that could save primary key (e.g. employee ID) to a table or Apex collection? Then the form button runs a process that finds the current ID then uses next or previous?
    I'm not sure how I could capture the PK in the report in order to save it.
    Does this make sense? Anyone got a better idea?
    Thanks,
    Stew

  • Getting the next valid date (jump holidays and weekends)

    Hello,
    I have a column table where I have all holidays of the year in the format "yyyymmdd,yyyymmdd,...", for example, "20091012,20091225".
    I'd like to do a query where I pass a date and a increment of days and it returns the next valid date, excluding weekends and the holidays that I have in the column holidays that I show above.
    P.S: Instead of pass a date and a increment of days, I could pass just a already incremented date, and this query just validate this date, adding 2 days for each weekend and one day for each holiday.
    Is there a way to do that?
    Thanks

    Hi,
    Ranieri wrote:
    Hello,
    I have a column table where I have all holidays of the year in the format "yyyymmdd,yyyymmdd,...", for example, "20091012,20091225".Dates should always be stored in DATE columns. If you really want to, your can also store the formatted date in a separate column.
    I'd like to do a query where I pass a date and a increment of days and it returns the next valid date, excluding weekends and the holidays that I have in the column holidays that I show above.For convenience, you can't beat a user-defined function, such as Etbin's.
    If you really want a pure SQL solution, you can
    (a) generate a list of all the days that might be between the start date and end date (sub-query all_days below)
    (b) outer join that to your holiday table (sub-query got_dnum, below)
    (c) rule out the holidays and weekends (sub_query got_dnum, WHERE clause)
    (d) return the nth remaining day (main query below)
    WITH     all_days     AS
         SELECT  TO_DATE (:start_date, 'DD-Mon-YYYY') + LEVEL     AS dt
         FROM     dual
         CONNECT BY     LEVEL <= 3           -- 3 = max. consecutive non-work days
                   + (:day_cnt * 7 / 4)     -- 4 = min. work days per week
    ,     got_dnum     AS
         SELECT     a.dt
         ,     ROW_NUMBER () OVER (ORDER BY a.dt)     AS dnum
         FROM          all_days     a
         LEFT OUTER JOIN     holidays     h     ON     a.dt = TO_DATE (txt, 'YYYYMMDD')
         WHERE     h.txt               IS NULL
         AND     TO_CHAR (a.dt, 'Dy')      NOT IN ('Sat', 'Sun')
    SELECT     dt
    FROM     got_dnum
    WHERE     dnum     = :day_cnt
    ;This assumes :day_cnt > 0.
    The tricky part is estimating how far you might have to go in sub-query all-days to be certain you've included at leas :day_cnt work days.
    Where I work, holidays are always at least 7 days apart.
    That means that there can be, at most, 3 consective days without work (which happens when there is a holiday on Monday or Friday), and that thee are at least 4 work days in any period of 7 consecutive days. That's where the "magic numbers" 3 and 4 come from in the CONNECT BY clause of all_days. Depending on your holidays, you may need to change those numbers.
    P.S: Instead of pass a date and a increment of days, I could pass just a already incremented date, and this query just validate this date, adding 2 days for each weekend and one day for each holiday.Good thought, but it won't quite work. How do you know how many holidays were in the interval? And what if the first step produces a Saturday before a Monday holioday?
    You might be interested in [this thread|http://forums.oracle.com/forums/message.jspa?messageID=3350877#3350877]. Among other things, it includes a function for determining if a given date (in any year) is a holiday, without reference to a table.

  • RetrieveLimitedRecordsCommand retrieving only 1000 records

    Hi All,
    While I am trying to retrieve records from the main table using RetrieveLimitedRecordsCommand I am getting only 1000 records from MDM, where as there are around 100000 records in the table.
    Could anyone help in this regard.
    Thanks and Regards,
    Subhasis

    The default page size is set to 1000, so if you have more than 1000 records, customize your code to increase the page size in loop.
    Here is how we did:
    Get the count total records = n //use the method getSearchTableMatchCount() on RetrieveLimitedRecordsExCommand
    int n = retrieveLimitedRecordsExCommand.getSearchTableMatchCount( ) ;
    Number of pages or Page size p
    int p = N / 1000 ;
    for( int i=1; i<=p ; i++ )
        //Now loop through the retrieve command from 1 to p and inside the loop take the records in an array.
    Now either you can implement it this way to get all the records in one shot. Or you can implement custom pagination on your table/result set view to retrieve the next 1000 records as required.
    And if you implement your custom pagination, you can also set the page size as per your design.
    Regards
    Nitin

  • Query to return next 7 dates

    Hello,
    is there a way to return the next 7 dates just using a query... for example, I need a query that returns:
    select (I don't know that put here) from dual
    Date
    2012-10-05
    2012-10-06
    2012-10-07
    2012-10-08
    2012-10-09
    2012-10-10
    2012-10-11
    If possible, I would like to know if there's a way to pass a date and based on it, the query returns the next 7 dates based on the passed date... for example:
    select (I don't know that put here) from dual where date > '2012-10-15'
    Date
    2012-10-16
    2012-10-17
    2012-10-18
    2012-10-19
    2012-10-20
    2012-10-21
    2012-10-22
    I really appreciate any help
    Thanks

    Sven W. wrote:
    I don't like connect by. That is fair enough, it is just your opinion.
    It is slow and shouldn't be used for real production code.This however, is absolute garbage.
    Changing the query to return 10,000 dates takes a little over 1s
    SQL> select date '2012-10-15' + level - 1 from dual
      2  connect by level <= 10000;
    <snip>
    28-FEB-40
    29-FEB-40
    01-MAR-40
    10000 rows selected.
    Elapsed: 00:00:01.26>
    In your case you can simply do this
    with inputdata as (select to_date('2012-10-15','yyyy-mm-dd') startday from dual)
    select startday+1 from inputdata union all
    select startday+2 from inputdata union all
    select startday+3 from inputdata union all
    select startday+4 from inputdata union all
    select startday+5 from inputdata union all
    select startday+6 from inputdata union all
    select startday+7 from inputdata ;
    Running your alternative for 10,000 dates took quite some time to create, needed to be put in a file to execute and has been running now for about 15 minutes
    select date '2012-10-15' + 1 from dual union all
    select date '2012-10-15' + 2 from dual union all
    <snip>
    select date '2012-10-15' + 9996 from dual union all
    select date '2012-10-15' + 9997 from dual union all
    select date '2012-10-15' + 9998 from dual union all
    select date '2012-10-15' + 9999 from dual union all
    select date '2012-10-15' + 10000 from dual
    ;It is much more code, takes more time to write, is proven to be incredibly slow and shouldn't be used for real production code.
    Edited by: 3360 on Oct 5, 2012 9:52 AM
    Sorry it took only 12 minutes, it seemed a lot longer when waiting for it
    29-FEB-40
    01-MAR-40
    01-MAR-40
    02-MAR-40
    10000 rows selected.
    Elapsed: 00:12:01.35

Maybe you are looking for

  • Mini Display Port to DVI Adapter

    Hi guys, I bought a MiniDisplayPort to DVI adapter @ Amazon to connect my Macbook (bought in 2009) with my Samsung 27" display. here's the link for the adapter: http://www.amazon.de/HDGear-DisplayPort-Adapter-Stecker-Buchse/dp/B002CBMZSA/ref =sr_1_3?

  • Report script - using substitution variable with multiple values

    Hi All, Substitution variable with multiple values is not working correctly with Report scripts. Can you please let me know what is the syntax to assign multiple values to a sub variable using maxl: alter database samp.samp set variable 'ExtractQuart

  • So why can't I get snow leopard to work?

    early 2008 mac pro. 32 GB ram test fine. 1.5 TB drive runs leopard-no problems. have installed snow leopard on a blank drive and after about 4 hours, i get the black box shutdown error message. cloned existing drive into a new hitachi drive, shuts do

  • Cumulative kf with load aggr

    hello BW Experts, What is a cumulative kf with 'load' aggregation behavior regarding the time dimension. scenario: fi-sl line-item extractor, 0balance is cumulative with 'load' aggregational behavior regarding the time dimension. Suggestions apprecia

  • Is it possible to add html code to iweb

    I need to add some special elements to a webpage, and I was curious if I could add any special html code besides the ones I have found in the menu (counter, links, etc) Thanks