Insert several rows in the data table table

Hi all

I have a requirement as to insert multiple rows in the table for this table data only (I need to replicate the data).
In this table, the primary key is a composite primary key with all the keys.primary foreign key and the foreign key to the Date. I need to change that date to the insertion.


INSERT
IN myschema. Fact_page_performance
(
time_sk,
Batch_ID,
delta_msec,
delta_user_msec,
error_code_sk,
content_errs,
element_count,
page_bytes,
Available,.
date_sk

)
VALUES
(SELECT time_sk,
Batch_ID,
delta_msec,
delta_user_msec,
error_code_sk,
content_errs,
element_count,
page_bytes,
Available
OF myschema. FACT_PAGE_PERFORMANCE_BACKUP
WHERE date_sk = 20090509, 20090510
);

But it gives error like missing expression.
Could someone please help me.

Thanks and greetings
Swetha.

You can have either the VALUES or not SELECT the two

INSERT
INTO myschema.Fact_page_performance
(
time_sk ,
batch_id ,
delta_msec ,
delta_user_msec,
error_code_sk ,
content_errs ,
element_count ,
page_bytes ,
Available ,
date_sk

)
SELECT time_sk ,
batch_id ,
delta_msec ,
delta_user_msec,
error_code_sk ,
content_errs ,
element_count ,
page_bytes ,
Available
FROM myschema.FACT_PAGE_PERFORMANCE_BACKUP
WHERE date_sk=20090509,20090510;

Tags: Database

Similar Questions

  • Update of several rows of the same table using trigger

    Hello

    I have the following table

    ---------------------------------------------------------------------------------------------------------

    CREATE TABLE ATT_PERMISSIONS
    (
    DATE OF PRMONTHYR,
    EMPIDNUMBER (10)DEFAULT VALUE 0,
    FROMDATETIMEDATE,
    TODMTFDATETIMEDATE,
    NUMBER OF PERMMINS (3),

    SSLINASTRETCH NUMBER (3).

    PERMATTINELIGIBLENUMBER (1)DEFAULT VALUE 0
    );

    ------------------------------------------------------------------------------------------------------

    I want to update the column PERMATTINELIGIBLE in the same table when each line is inserted.

    I created following trigger for that

    CREATE OR REPLACE TRIGGER SSL_AFTER_UPDATE AFTER UPDATE ON ATT_PERMISSIONS

    FOR EACH LINE

    BEGIN

    Update ATT_PERMISSIONS set PERMATTINELIGIBLE =

    (

    SELECT THE CHECK BOX

    WHEN PERMMINS < = 60

    or

    (

    PERMMINS < = SSLINASTRETCH

    AND

    COUNT (CASE WHEN PERMMINS = 0 THEN NULL OTHERWISE 1 END)

    COURSES (PARTITION BY empid, prmonthyr) < = 1

    )

    THEN 1

    0 OTHERWISE

    END

    FROM ATT_PERMISSIONS where prmonthyr =:new.prmonthyr, empid =:new.empid

    ) where prmonthyr =:new.prmonthyr, empid =:new.empid;

    END;

    ---------------------------------------------------------------------------------------------------

    That is to say.

    When a row is inserted the PERMATTINELIGIBLE of all records for this employee for the month is recalculated.

    There would be only two or three records for an employee for a month.

    PERMMINS is the number of minutes to use as short leave.

    If it is less than 60 is eligible for the bonus to attendance for this employee.

    If this isn't normally the date is not eligible for the attendance for this employee premium.

    but an exception is that if a short leaves of DISP employee allowed a month (IE. ( SSLINASTRETCH ) in a straight line, IE. one day, that day is eligible for the bonus of presence.

    That is to say. Why the number of short leaves in a month is taken. If it's one and done minutes use is lower to SSLINASTRETCH, then the day is eligible for the attendance bonus.

    But when I try to create the trigger I get error, PL/SQL: ORA-00907: missing a right parenthesis.

    Help, please

    I use oracle 10g

    I want to update the column PERMATTINELIGIBLE in the same table, when each row is inserted.

    No - you do NOT want to do in a trigger.

    You cannot query the same table that the trigger is activated on. -C' is a MUTANT and you will get an exception.

    When a row is inserted is recalculated to the PERMATTINELIGIBLE of all the records for that employee for that month.

    There would be only two or three records for an employee for a month.

    PERMMINS is the number of minutes to use as short leave.

    If it is less than 60 is eligible for the bonus to attendance for this employee.

    If is not normally the day is not eligible for the premium of attendance for this employee.

    but an exception is that if a short leaves of DISP employee allowed a month (IE. SSLINASTRETCH) in a straight line, IE. one day, that day is eligible for the bonus of presence.

    That is to say. Why the number of short leaves in a month is taken. If it's one and done minutes use is less than SSLINASTRETCH, then the day is eligible for the bonus of presence.

    But when I try to create the trigger I get error, PL/SQL: ORA-00907: missing a right parenthesis.

    You can not do in a trigger. Even if correct you this error of syntax, you will get the exception that I mentioned above.

    Oracle is a multi-user system. Other users can modify the same table that you use.

    So even if you could try to interview "all the records for this employee" some of them may be locked if other users access them. Also, an insert statement could try to insert two rows for an employee and the trigger could not have seen the other lines still.

    If you want to work with data SETS (all records for an employee), you must write the PL/SQL code that LOCKS all lines updated to prevent others to interfere.

    Then you make your operations but NOT in a trigger. Perform inserts and then use an UPDATE query to set this value.

    Then VALIDATE to unlock the lines.

  • Rows from the outer Table shows only not all data.

    Hello

    I have a line to 80 characters that I import in an external table.

    80% imports fine line data, but some lines are cut.

    The bytes in the file are as follows.
    ABCABC2334 0000001000010000001000000001 000000 00001C A002

    Bytes in an external table.
    ABCABC2334 0000001000010000001000000001 000000 A002

    The bytes in the row of the outer table stop somewhere at the end of 000000 and the 00001C is cut.

    What build be the cause of this?

    I am able to read the characters at the beginning and towards the end of the record of 80-character line.

    The external file below performs the following operations.
    ABCABC2334 0000001000010000001000000001 000000 01B A002

    I can even make a definition of the external table (c1 char (1), c2 char (1),... c80 (1) tank and all the characters see fine in the specified columns.)

    Here is the last definition of the external table. The "middle" column still shows this behavior. Basically, it is in the file and can be seen with every character in the definined line, but not as a group of characters.

    DB CHARACTERSET WEBISO8859P1

    CREATE TABLE EXT_PROJ_1
    (
    Field1 tank (6 BYTES),
    Field2 float (4 BYTES),
    medium (67 BYTES)
    field3 tank (3 bytes),
    CR tank (2 bytes)
    )
    EXTERNAL ORGANIZATION
    (TYPE ORACLE_LOADER
    THE DEFAULT DIRECTORY EXP_DIR
    ACCESS SETTINGS
    (
    RECORDS delimited by '\r\n '.
    FIELDS (field1, position(1:6),
    position(7:10) Field2.
    average position(11:77)
    field3 position(78:80).
    CR position(81:82)
    )
    )
    LOCATION (EXP_DIR: 'ext_proj_1.txt')
    )
    REJECT THE LIMIT 1
    noPARALLEL
    NOMONITORING;

    Published by: 917320 on March 13, 2012 09:07

    Looking at your table definition:

    field1 char(6 BYTE),
    field2 char(4 BYTE),
    middle char(67 BYTE),
    field3 char(3 byte),
    cr char(2 byte)
    

    column in which you will store a string of 80 bytes?

    BTW: You said "import into an external table." You import FROM an external table or EXPORT to an external table?

  • Using Merge in oracle 11g this error SQL Error: ORA-30926: failed to get a stable set of rows in the source tables

    whenever I run this code I get this error

    SQL Error: ORA-30926: failed to get a stable set of rows in the source tables

    30926 00000 - "impossible to get a stable set of rows in the source tables.

    * Cause: A stable set of rows could not be achieved due to the large dml

    activity or one not deterministic where clause.

    * Action: Remove any non deterministic of the clauses and reissue of the dml.

    Don't know wht goes wrong!


    SQL:

    MERGE IN VENDORS_ACTIVE_DATE s

    USING (nvl (d.VENDOR, s.VENDOR) selection of the SELLER,

    NVL (d.COMPANY_CODE, s.COMPANY_CODE) COMPANY_CODE.

    (case when ((d.VENDOR = s.VENDOR) and (d.COMPANY_CODE = s.COMPANY_CODE)))

    )

    then "MATCH".

    When d.COMPANY_CODE is null

    then 'DELETE '.

    When s.COMPANY_CODE is null

    then "INSERT."

    else 'UPDATE '.

    chck end)

    from (select * from VENDORS_ACTIVE_DATE where COMPANY_CODE = 2) s

    full outer join (select * provider where COMPANY_CODE = 2) d

    on (d.COMPANY_CODE = s.COMPANY_CODE AND s.COMPANY_CODE = 2)

    ) d

    WE (d.COMPANY_CODE = s.COMPANY_CODE AND d.chck in ('UPDATE', 'GAME', 'DELETE'))

    WHEN MATCHED THEN

    UPDATE SET s.VENDOR = d.VENDOR

    WHERE d.chck in ('UPDATE', 'DELETE')

    DELETE WHERE d.chck = 'DELETE '.

    WHEN NOT MATCHED THEN

    INSERT (SELLER, COMPANY_CODE)

    VALUES (d.VENDOR, d.COMPANY_CODE)

    Work request: (deleted the duplicate data in tables (source and target))

    MERGE IN VENDORS_ACTIVE_DATE s

    USING (nvl (d.VENDOR, s.VENDOR) selection of the SELLER,

    NVL (d.ACTIVEDATE, s.ACTIVEDATE) ACTIVEDATE.

    NVL (d.COMPANY_CODE, s.COMPANY_CODE) COMPANY_CODE.

    (case when ((d.VENDOR = s.VENDOR))

    - AND D.ACTIVEDATE = S.ACTIVEDATE

    and NVL (d.ACTIVEDATE, trunc (sysdate)) = NVL (s.ACTIVEDATE, trunc (sysdate))

    and (d.COMPANY_CODE = s.COMPANY_CODE)

    )

    then "MATCH".

    When d.COMPANY_CODE is null

    then 'DELETE '.

    When s.COMPANY_CODE is null

    then "INSERT."

    else 'UPDATE '.

    chck end)

    from (select * from suppliers where COMPANY_CODE = 2) d

    full outer join (select * from vendors_active_date where COMPANY_CODE = 2) s

    on (d.COMPANY_CODE = s.COMPANY_CODE and s.vendor = d.vendor)

    ) d

    WE (d.COMPANY_CODE = s.COMPANY_CODE AND d.VENDOR = s.VENDOR AND d.chck in ('UPDATE', 'GAME', 'DELETE'))

    WHEN MATCHED THEN

    S.ACTIVEDATE = UPDATE SET d.ACTIVEDATE

    WHERE d.chck in ('UPDATE', 'DELETE')

    DELETE WHERE d.chck = 'DELETE '.

    WHEN NOT MATCHED THEN

    INSERT (VENDOR, ACTIVEDATE, COMPANY_CODE)

    VALUES (d.VENDOR, d.ACTIVEDATE, d.COMPANY_CODE)

  • FUSION IN: ORA-30926: failed to get a stable set of rows in the source tables

    Hi all

    Database Oracle 12 c Enterprise Edition Release 12.1.0.1.0 - 64 bit Production 0

    PL/SQL Release 12.1.0.1.0 - Production 0

    CORE 12.1.0.1.0 Production 0

    AMT for 64-bit Windows: Version 12.1.0.1.0 - Production 0

    NLSRTL Version 12.1.0.1.0 - Production 0

    When you use the MERGE clause, if executed more than once, I get the below error

    ORA-30926: failed to get a stable set of rows in the source tables

    create table CBC (nums number, sname varchar2 (10))

    create tar (tnum number, tNom varchar2 (10)) table

    Insert in src values (1, 'a')

    Insert in src values (1, 'b')

    Insert in src values (2, "c")

    merge into tar

    using the CBC

    on (nums = tnum)

    when matched

    then

    update the value tNom = sname

    When not matched

    then

    Insert the values(snum,sname);

    What expect, it's that first time itself (when inserted), he must raise the error. But it's not.

    Select * from tar

    TNUM TNOM

    1 b

    1 a

    2 c

    But if we run for the second time it shows the error.

    I saw the document of the Oracle and he said

    MERGEis a deterministic statement. You cannot update the same row in the target table multiple times in the same MERGE statement.

    I've seen below cela son but failed to get the solution for this.

    MERGE STATEMENT ORA-30926: failed to get a stable set of lines in the source

    Nondeterministic fusion?

    Someone at - it make a clarification?

    I don't want to insert records into the first time itself. for example, to run the first time he must raise the error. can I do this using MERGE?

    Thank you

    Hello

    O - O wrote:

    Thanks knani, Frank.

    One more doubt.

    When you run the MERGE statement, the first time, there is no rows in the target table, so no rows in the target table is what it is.

    So we cannot perform below sqls using MERGE when the target table is empty?

    insert into tar values (1, 'a')

    updated tar tNom = 'b' set where tnum = 1

    insert into tar values (2, "c")

    Is - that means that the MERGER will be only works with validated data?

    Right; a MERGE statement will not update a line which has been previously inserted into the same MERGE statement.  All fact tables reference to the data in the tables by the time the MERGER began.

  • Compare two rows in the same table

    Hi all

    I need to compare two rows in the same table, I don't know hoe to do it in pl/sql. Please help me on this.

    example:

    price of ro TR
    xya0001 AMA.7 12
    xya0003 ama6 14
    xya0004 AMA.7 16

    in table b is a unique value for each line, I need to compare the price column and see if the first value is less than or greater than the following value and, if there is more to put the corresponding value of br to a variable, and if it is less, put the corresponding value of the br to another variable. I don't know a method to do this, as I'm new to pl/sql. Please help me in this
    for data in(select tr,br,price, lag(price) over ( order by tr) newcol
    from yourtable)
    loop
    if nvl(data.newcol,0) > data.price then
    variable1:=data.br;
    else
    varable2:=data.br;
    end if;
    end loop;
    
  • ADFDI-05577: could not retrieve the data table on the server.

    Dear all,

    My use case is, when I opened my excellent work book, I have this error message is out ' ADFDI-05577: could not retrieve the data table on the server line "and when I click on the button 'OK' of the error message I can recover all the data on the server. Please help me how to solve this error?


    Concerning
    KT

    Thanks much Sireesha Pinninti, John Stegeman, Arun.

    Yes, my problem is of subquery. I found a solution from this site.
    http://www.DBA-Oracle.com/t_ora_01427_single_row_subquery_returns_more_than_one_row.htm,
    http://srinisboulevard.blogspot.com/2010/04/ora-01427-single-row-subquery-returns.html
    http://StackOverflow.com/questions/3804850/erroneous-ora-01427-single-row-subquery-returns-more-than-one-row / / the answer is the last line

    Before change (error subquery)

    CheckingEO.BO,
    (SELECT ntr_no FROM test
    WHERE cs_no = CheckingEO.CS_NO) NTR_NO
    To archive the CheckingEO

    Edit it like this

    (SELECT ntr_no FROM test
    WHERE cs_no = CheckingEO.CS_NO and Rownum = 1) NTR_NO
    To archive the CheckingEO

    Concerning
    KT

    Published by: KT on 23 May 2012 15:35

    Published by: KT on 23 May 2012 15:48

  • Impossible to get a stable set of rows in the source tables

    Hi guys,.

    I use the following query to fusion in a stored procedure.
       MERGE INTO tt_OPEN_IN_TMP B
       Using (Select * From Tt_Sl_Fifo) A 
       ON ( A.Store_Code = B.Store_Code
         AND A.item_code = B.item_code
         And A.Packing = B.Packing
         And A.Serial_No = B.Serial_No )
       When Matched Then Update Set Opn_Fifo_Cost = A.Rate_Bc;
    The procedure raises error * "Unable to get a stable set of rows in the source tables" * as a result of the query. But if I run the query individually, it works very well. Please help me solve this problem.

    Thank you
    RAM.

    The error is due to what there is in double store_code, item_code, packaging, combination of serial_no in the Tt_Sl_Fifo table. If there are multiple records with the same store_code, item_code, packaging, serial_no Oracle has no way to determine which to use for the update. If you know that there is whenever duplicates they will all have the same column of rate_bc then instead of using

    (select * from tt_sl_fifo)
    

    use

    (select distinct store_code, item_code, packing, serial_no, rate_bc from tt_sl_fifo)
    

    Or if there is other criteria, like a date column, you can use to determine what is the one you want to use to day then you can use something like

    (select store_code, item_code, packing, serial_no, rate_bc from tt_sl_fifo
      where (store_code, item_code, packing, serial_no, add_date) in
           (select store_code, item_code, packing, serial_no, max(add_date)
              from tt_sl_fifo group by store_code, item_code, packing, serial_no))
    
  • I want to delete a row in the LOV table (in the context menu of JHS - LOV) but...

    Hi all
    JDeveloper: Studio Edition Version 11.1.2.2.0
    Jheadstart: 11.1.2.1.28
    I want to delete a row in the LOV table (in the context menu of JHS - LOV), but it removes the first line...
    Help, please

    Can,

    I was able to reporduce, this is a bug in LovPageBean.
    We will fix this with the next release, you can apply the following work around:

    -create a subclass of LovPageBean

    -replace the selectionListener following method:

    public void selectionListener (org.apache.myfaces.trinidad.event.SelectionEvent selectionEvent)
    {
    Object oldRowKey is getLovTable () .getRowKey ();.
    VR;
    {
    The selectedRows list = new ArrayList();
    setSelectedRowKeySet (getLovTable () .getSelectedRowKeys ());
    Iterator it = getSelectedRowKeySet () .iterator ();
    While (it.hasNext ())
    {
    List keyList = it.next () (list).
    getLovTable () .setRowKey (keyList);
    JUCtrlHierNodeBinding selectedRowData is getLovTable () .getRowData () (JUCtrlHierNodeBinding);.
    Line = selectedRowData.getRow ();
    If (! isMultiSelect())
    {
    make the current line, so removing line will operate in page LOV
    selectedRowData.getIteratorBinding () .getRowSetIterator () .getRowSet () .setCurrentRow (row);
    }
    selectedRows.add (new RowData (row));
    }
    If (isMultiSelect())
    {
    getLovItemBean () .setSelectedRowDataList (selectedRows);
    }
    on the other
    {
    If (selectedRows.size () > 0)
    {
    getLovItemBean () .setSelectedRowData (selectedRows.get (0));
    }
    on the other
    {
    getLovItemBean () .setSelectedRowData (null);
    }
    }
    }
    Finally
    {
    restore old line key
    getLovTable () .setRowKey (oldRowKey);
    }
    }

    -Conduct a custom template for the LovPageBean.vm to use your subclass.

    Steven Davelaar,
    Jheadstart team.

  • Get the number of rows in the oracle table

    Hi all
    I want to get the total number of rows in the sql to the appmodule table.
    After you apply the criteria to view some on the view object. If he try with getallrowsinrange the number of rows found within the viewobject was but I want a total number of rows in the sql table.

    How can I get that

    I use jdev 11.1.1.5

    Thanks in advance

    I threw something together, quick and dirty, don't hesitate to optimize.

    Assuming you want the County table, I put the code in a subclass of EntityDefImpl since it is representing a table in the middle tier.

    public class EmpDefImpl
          extends EntityDefImpl {
      /**
       * This is the default constructor (do not remove).
       */
      public EmpDefImpl( ) {}
    
      //~ Methods ****************************************************************************
    
      public long getTableRowCount( DBTransaction transaction ) {
        String query = getQuery( );
        String countQuery = String.format( "SELECT COUNT(*) FROM (%s)", query );
        long count = 0;
    
        ViewObject vo = transaction.createViewObjectFromQueryStmt( countQuery );
    
        try {
          vo.executeQuery( );
    
          Row row = vo.first( );
          Number number = (Number)row.getAttribute( 0 );
          count = number.longValue( );
        } finally {
          vo.remove( );
        }
    
        return count;
      }
    }
    

    Depending on your card type, you may not get an oracle.jbo.domain.Number, but something else, so the cast may need correction.

    Usage example:

    public class EmpEditViewImpl extends ViewObjectImpl {
      public EmpEditViewImpl() {
      }
    
      protected void executeQueryForCollection( Object object, Object[] object2, int i ) {
        super.executeQueryForCollection( object, object2, i );
    
        EmpDefImpl def = ( EmpDefImpl )getEntityDef( 0 );
        long tableRowCount = def.getTableRowCount( getDBTransaction() ) );
    
        // Do something with it
      }
    }
    

    As you can see, the code is fairly generic. Also, you might be able to put this in a base extension ADF class.

    Sascha

    Published by: Sascha Herrmann on June 7, 2012 14:39

  • Select several entire rows in the data grid does not work

    SQL Dev 2.1.1.64 on Windows XP.
    I can select an entire row in the data grid (or the result of the query) by clicking on the left with the line number column. I expect to select several lines by clicking and dragging, but it won't work. He worked in v1.5.
    Thank you
    MVr.

    Still 3 other ways I see:
    * Click the line number of the first row, then shift + click on the line number of the last row
    * Click on the first cell in the first row, and then drag to the last cell of the last row
    * Click the line number of the second line, and then click the first cell in the first row and drag until the last line (most like what you want)

    Have fun
    K.

  • ORA-30926: failed to get a stable set of rows in the source table

    Dear all

    When I try to load my cube I get the error "ora-30926: failed to get a stable set of rows in the source table.
    Any idea? Googling for this error has not returned all the solutions.

    My env:

    Source: Oracle 10g (10.2.x)
    Target: Oracle 11g (11.1.0.7)

    I use the generator to warehouse 11.1.0.7 on Linux

    Thank you

    Hello

    Yes, I'm very sure. The error is revived by the MERGE statement.
    If the cube is empty, it is not a problem. All of the rows from the source Gets a surrogate key.
    If you run the cube for the second time, and you have two or more lines with exact in the attributes values as you use for correspondence, this error occurs.

    Kind regards
    Carsten.

  • How to get several items when I select several rows in the DataGrid?

    Hi all

    I have a scenario where I have a datagrid and I have a few records in the datagrid control. I want to just select several lines of the data grid and display all the selected lines in datagrid, another... This as a multiple choice of datagrid... can someone tell me how I can achieve this scenario...?

    Thank you

    RAM

    Only, you should be able to use selectedItems.

  • Add more than 2 lines for a select statement without inserting rows in the base table

    Hi all

    I have a below a simple select statement that is querying a table.

    Select * from STUDY_SCHED_INTERVAL_TEMP
    where STUDY_KEY = 1063;

    but here's the situation. As you can see its return 7 ranks. But I must add
    2 rows more... with everything else, default or what exist... except the adding more than 2 lines.
    I can't insert in the base table. I want my results to end incrementing by 2 days in
    measurement_date_Taken on 01-APR-09... so big measurement_date_taken expected to
    end at study_end_Date...



    IS IT STILL POSSIBLE WITHOUT INSERT ROWS IN THE TABLE AND PLAYIHY ALL AROUND WITH
    THE SELECT STATEMENT?

    Sorry if this is confusing... I'm on 10.2.0.3

    Published by: S2K on August 13, 2009 14:19

    Well, I don't know if this request is as beautiful as my lawn, but seems to work even when ;)
    I used the "simplified" version, but the principle should work for your table, S2K.
    As Frank has already pointed out (and I fell on it while clunging): simply select your already existing lines and union them with the 'missing documents', you calculate the number of days that you are "missing" based on the study_end_date:

    MHO%xe> alter session set nls_date_language='AMERICAN';
    
    Sessie is gewijzigd.
    
    Verstreken: 00:00:00.01
    MHO%xe> with t as ( -- generating your data here, simplified by me due to cat and lawn
      2  select 1063 study_key
      3  ,      to_date('01-MAR-09', 'dd-mon-rr') phase_start_date
      4  ,      to_date('02-MAR-09', 'dd-mon-rr') measurement_date_taken
      5  ,      to_date('01-APR-09', 'dd-mon-rr') study_end_date
      6  from dual union all
      7  select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('04-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
      8  select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('09-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
      9  select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('14-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
     10  select 1063, to_date('03-MAR-09', 'dd-mon-rr') , to_date('19-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
     11  select 1063, to_date('22-MAR-09', 'dd-mon-rr') , to_date('23-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual union all
     12  select 1063, to_date('22-MAR-09', 'dd-mon-rr') , to_date('30-MAR-09', 'dd-mon-rr') , to_date('01-APR-09', 'dd-mon-rr') from dual
     13  ) -- actual query:
     14  select study_key
     15  ,      phase_start_date
     16  ,      measurement_date_taken
     17  ,      study_end_date
     18  from   t
     19  union all
     20  select study_key
     21  ,      phase_start_date
     22  ,      measurement_date_taken + level -- or rownum
     23  ,      study_end_date
     24  from ( select study_key
     25         ,      phase_start_date
     26         ,      measurement_date_taken
     27         ,      study_end_date
     28         ,      add_up
     29         from (
     30                select study_key
     31                ,      phase_start_date
     32                ,      measurement_date_taken
     33                ,      study_end_date
     34                ,      study_end_date - max(measurement_date_taken) over (partition by study_key
     35                                                                          order by measurement_date_taken ) add_up
     36                ,      lead(measurement_date_taken) over (partition by study_key
     37                                                          order by measurement_date_taken ) last_rec
     38                from   t
     39              )
     40         where last_rec is null
     41       )
     42  where rownum <= add_up
     43  connect by level <= add_up;
    
     STUDY_KEY PHASE_START_DATE    MEASUREMENT_DATE_TA STUDY_END_DATE
    ---------- ------------------- ------------------- -------------------
          1063 01-03-2009 00:00:00 02-03-2009 00:00:00 01-04-2009 00:00:00
          1063 03-03-2009 00:00:00 04-03-2009 00:00:00 01-04-2009 00:00:00
          1063 03-03-2009 00:00:00 09-03-2009 00:00:00 01-04-2009 00:00:00
          1063 03-03-2009 00:00:00 14-03-2009 00:00:00 01-04-2009 00:00:00
          1063 03-03-2009 00:00:00 19-03-2009 00:00:00 01-04-2009 00:00:00
          1063 22-03-2009 00:00:00 23-03-2009 00:00:00 01-04-2009 00:00:00
          1063 22-03-2009 00:00:00 30-03-2009 00:00:00 01-04-2009 00:00:00
          1063 22-03-2009 00:00:00 31-03-2009 00:00:00 01-04-2009 00:00:00
          1063 22-03-2009 00:00:00 01-04-2009 00:00:00 01-04-2009 00:00:00
    
    9 rijen zijn geselecteerd.
    

    Is there a simpler way (in SQL), I hope that others join, and share their ideas/example/thoughts.
    I feel that it is using more resources there.
    But I have to cut the daisies before now, they interfere my 'grass-green-ess";)

  • How to insert a row into the table from an entity class

    I use JDeveloper 11.1.2.3.0 using ADF.  I would like to insert a row in Table B, when A table is inserted into the database based on a value selected by the end user.  I could do in a database trigger, but I would try in the ADF. I think that the best place to do it would be in the entity based on the table A class. I could override the doDML method and search for DML_INSERT

    and make the table insert B here, but I don't know the best way to achieve this.  I guess I want to avoid using a SQL "insert". I'm new to ADF and it can be difficult to get

    a question using the appropriate terminology. I hope this makes sense.

    Hello

    Check out this blog: http://andrejusb.blogspot.com/2008/02/complex-insert-in-easy-way.html

    Arun-

Maybe you are looking for

  • Portege R700 - Touch Pad, ecoUtility and presentation of the key does not

    Hello I got a Portege R700 with Windows 7 64 bit.This machine starts very slowly after the log in user mode only.The system is waiting for 1 to 2 Minutes before you can work. In administrator mode erverything is fine and fast. Thus our directors thou

  • Notes won't lock on 9.3

    I update my phone to the iOS 9.3, and one of the new features is to lock your notes. Well, my icon is not in the upper right corner, it is down in the middle of the app. Does anyone have an idea how to get then notes will be lock?

  • Does anyone have ideas if you can wear the Apple Watch in a water park

    Electroisolante afternoon guy, is - anyone haz of ideas so you can wear the Apple Watch at a Waterpark? Please give clues of meh that I'm about to get a Apple Watch for my birthday

  • Big file save

    Hi all I worked in a script in DIAdem, and I met a sink big time. Some of the files I work with are more than 200 MB and these files load in a minute or two but when I save the data, it can take 20 minutes to save. I was wondering if there is any way

  • Lenovo X 240 of 1866 Mhz. no luck module, the system is not posting

    I wonder why it does not accept my new memory Hyper X PNP of 1866. This will greatly improove video performance VM is retrieved from RAM. Any expert lenovo can help me here? Do I need a mod of bios or something?