High logical reads with the INSERT statement

Hello

I have an INSERT query that is having a very high reading statspack logical reads. I've seen go Asktom announcement that this is due to the index. Link: [http://asktom.oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:6643159615303]

Can you please help to explain exactly what Oracle do and why you should read so the e/s logic. It's the that oracle must read the structure of the index for all (bundle branch block + all blocks of sheet) for each insertion line?

Thanks & appreciate the insight.

Rgds
Ung

Only 5 bound for first INSERTION and only 1 for the next INSERTION.

This is false.

"db block ' is ALSO to the e/s logic." This is gets them in CURRENT mode. Oracle reads the Index blocks in the current mode to update the index blocks.

Your last statement is in direct contradiction with the previous paragraph

As Tom mentioned, oracle must change the index as well when records are inserted in > (or updated or deleted from) the table. This means oracle must first read the index blocks (in > compatibility mode (LIO) as well as in current mode) in addition to the blocks of the turntable when inserting new > records. So this must explain why LIOs are more when inserting in an indexed table from > inserting into a table not indexed.

What is correct.

Hemant K Collette
http://hemantoracledba.blogspot.com

Tags: Database

Similar Questions

  • Help with the insert statement

    Hello

    I was wondering if someone could help write me a sql statement.

    Here is my table:
    CREATE TABLE "TEMP_INVOICE" 
       ("INVOICE" VARCHAR2(100 BYTE),
         "DATE_OF_DOCUMENT" DATE, 
         "DATE_OF_PAY_DAY" DATE, 
         "D" NUMBER, 
         "K" NUMBER
       );
    Here are the instructions for correct insertion. This time, I posted 2 examples with 2 numbers different otherwise.
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (1000,to_date('01.02.2012','dd.mm.yyyy'),to_date('01.03.2012','dd.mm.yyyy'),5000,0);
     
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (1000,to_date('01.04.2012','dd.mm.yyyy'),'','',1000);
     
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (1000,to_date('01.05.2012','dd.mm.yyyy'),'','',3000);
     
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (1000,to_date('01.06.2012','dd.mm.yyyy'),'','',1000);
    
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (2000,to_date('01.07.2012','dd.mm.yyyy'),to_date('01.09.2012','dd.mm.yyyy'),8000,0);
     
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (2000,to_date('01.10.2012','dd.mm.yyyy'),'','',5000);
     
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (2000,to_date('01.11.2012','dd.mm.yyyy'),'','',2000);
     
    insert into temp_invoice (invoice,DATE_OF_DOCUMENT,DATE_OF_PAY_DAY,d,k)  values (2000,to_date('01.12.2012','dd.mm.yyyy'),'','',1000);
    I want to do is make an insert allows you to table another call is MADE:
    CREATE TABLE "INVOICE" 
       ("INVOICE" VARCHAR2(100 BYTE),
        "DATE_OF_DOCUMENT" DATE, 
         "DATE_OF_PAY_DAY" DATE,
         "DATE_OF_PAYMENT_REC" DATE,
         "VALUE" NUMBER,
         "VALUE_DEDUCT" NUMBER,
        "DATE_FROM" DATE,     
         "DATE_TO" DATE
         );
    Statements in the INVOICE table should be like this:


    ........ The Bill... date_of_document... date_of_pay_day... date_of_payment_rec... value... value_deduct... Date_from... Date_to
    1......     1000...............1.1.2012.................1.3.2012................NULL............................ 5000... NULL... 1.3.2012...1.4.2012
    2......     1000...............1.4.2012.................NULL..................... 1.4.2012...1000... 4000... 2.4.2012... 1.5.2012
    3......     1000...............1.5.2012.................NULL..................... 1.5.2012...3000... 1000... 2.5.2012... 1.6.2012
    4......     1000...............1.6.2012.................NULL..................... 1.6.2012...1000


    Can someone help me with the sql statement that would insert data from table to table Bill temp_invoice as in the example?

    Thank you!

    PS

    I would try to explain.
    (1) the first statement that is to be inserted is original imply that at which is different DATE_OF_PAY_DAY to NULL.
    To this inserted negative of the original imply, we must add date_from that is exatly the same date_of_pay_day and date_to which is exactly the same as the date of the first payment. Payment which came first!
    (2) we have now in the second insert statement. It will be the first payment of lease with date_of_document and date_pf_payment_rec, which is the same as date_fo_document. Value field will be populated with the amount of payment received and value_deduct field will be the value of the original imply - value of the first payment. Date is date_of_document + 1 and date_to is the date of the next payment.
    (3) Insert us the next installment. Date_od_payment_rec is the same as date_of_document... value is the amount of the second payment and value_deduct's previous value_deduct which was of 4000 - value of this second payment. date_from date_of_payment_rec + 1 and date_to is the date of the next payment

    So we continue this same pattern until we reached the final payment when we finish insert with the statement:
    Date of the document (date of the last payment received) and even for date_of_payment_rec and field value with the amount of the payment receieved. The rest (value_deduct, date_from, date_to) is null.

    I really hope you understand what I'm trying to do here.

    If you have any other questions please.

    Published by: user13071990 on November 22, 2012 04:16

    Published by: user13071990 on November 22, 2012 04:16

    Hello

    user13071990 wrote:
    ... Here are the instructions for correct insertion. This time, I posted 2 examples with 2 numbers different otherwise.

    Ok!
    Be sure to post the results you want new data.

    You probably need to add "PARTITION BY the Bill" to all analytical clauses in my solution:

    INSERT INTO invoice
    ( invoice, date_of_document, date_of_pay_day, date_of_payment_rec
    , value,   value_deduct,     date_from,           date_to
    )
    SELECT       invoice
    ,       date_of_document
    ,       date_of_pay_day
    ,       CASE
               WHEN  k > 0
               THEN  date_of_document
           END          AS date_of_payment_rec
    ,       NVL (d, k)     AS value
    ,       NVL2 ( date_of_pay_day
                , NULL
                , SUM (d) OVER ( PARTITION BY  invoice
                                          ORDER BY      date_of_document
                         )
                - SUM (k) OVER ( PARTITION BY  invoice
                                          ORDER BY      date_of_document
                         )
                )     AS value_deduct
    ,       NVL ( date_of_pay_day
               , date_of_document + 1
               )          AS date_from
    ,       LEAD (date_of_document) OVER ( PARTITION BY  invoice
                                            ORDER BY      date_of_document
                               )
                          AS date_to
    FROM       temp_invoice
    ;
    

    Because I'm not an English speaker nativ, that I just posted what it should look like after the insert is successful.

    OK, so you can't explain as you want, but you still need to explain.

    ... @Frank Kulash: you are very close, but still not quite what I'm looking for.

    Point out where my solution is the production of incorrect results, and explain (as you can) how to get good results in these places.

  • Need help with the insert statement

    Hello

    I have a question on how to write a SQL statement.

    This is the table of "base":
    CREATE TABLE TEMP_TBL
    (
    id_nr NUMBER,
    DATE_DOK DATE,
    DATE_DUE DATE,
    DATE_DOK_PAY DATE,
    DEB NUMBER,
    KRD NUMBER
    );
    
    insert into temp_tbl (ID_NR,DATE_DOK,DATE_DUE,DATE_DOK_PAY,DEB,KRD)values('1',TO_DATE('11.01.2011','DD.MM.YYYY'),TO_DATE('25.02.2011','DD.MM.YYYY'),NULL,'423,24','0');
    insert into temp_tbl(ID_NR,DATE_DOK,DATE_DUE,DATE_DOK_PAY,DEB,KRD)values('2',TO_DATE('16.12.2011','DD.MM.YYYY'),TO_DATE('13.06.2011','DD.MM.YYYY'),NULL,'91270,15','0');
    insert into temp_tbl(ID_NR,DATE_DOK,DATE_DUE,DATE_DOK_PAY,DEB,KRD)values('3',TO_DATE('27.09.2011','DD.MM.YYYY'),TO_DATE('27.09.2011','DD.MM.YYYY'),NULL,'0','2000');
    and it comes to resoult in the target table. SQL statement must take care of the insert in a base of the target table table (example below is already provided with test data).
    create table table_sod
    (
    
          id_nr number
         ,date_from date
         ,date_to date
         ,deb_krd number
    
    );
    
    One thing to note here :  values in column deb_krd under insert 1 and 4 must be summarized in insert 4.
    
    insert into table_sod (id_nr,date_from,date_to,deb_krd) values('1',null,to_date('25.02.2011','dd.mm.yyyy'),'423,24');
    insert into table_sod(id_nr,date_from,date_to,deb_krd) values('2',to_date('26.02.2011','dd.mm.yyyy'),to_date('13.06.2011','dd.mm.yyyy'),'423,24');
    insert into table_sod(id_nr,date_from,date_to,deb_krd)values('3',null,to_date('13.06.2011','dd.mm.yyyy'),'91270,15');
    insert into table_sod(id_nr,date_from,date_to,deb_krd)values('4',to_date('14.06.2011','dd.mm.yyyy')to_date('27.09.2011','dd.mm.yyyy'),'91693,39');
    insert into table_sod(id_nr,date_from,date_to,deb_krd)values('5',null,to_date('27.09.2011','dd.mm.yyyy'),'2000');
    If someone could give me a helping hand how write correct insert statement I would be really gratefull.

    Thank you for your time!

    I came here with my own assumptions with this

    SQL> select rownum id_nr
      2       , date_from
      3       , date_to
      4       , case when date_from is null then deb
      5              else sum(case when date_from is not null then deb else 0end) over(order by id_nr, no)
      6         end deb_krd
      7    from (
      8            select id_nr
      9                 , case when lg_dt is null or ld_dt = date_due then  null else lg_dt+1 end date_from
     10                 , ld_dt date_to
     11                 , case when deb = 0 then krd else deb end deb
     12                 , no
     13              from (
     14                      select t1.*
     15                           , lead(t1.date_due) over(order by t1.id_nr, t2.no) ld_dt
     16                           , lag(t1.date_due) over(order by t1.id_nr, t2.no) lg_dt
     17                           , t2.no
     18                        from temp_tbl t1
     19                       cross
     20                       join (select 1 no from dual union all select 2 no from dual) t2
     21                       order by id_nr, no
     22                   )
     23             where ld_dt is not null
     24         )
     25  /
    
         ID_NR DATE_FROM DATE_TO      DEB_KRD
    ---------- --------- --------- ----------
             1           25-FEB-11      42324
             2 26-FEB-11 13-JUN-11      42324
             3           13-JUN-11    9127015
             4 14-JUN-11 27-SEP-11    9169339
             5           27-SEP-11       2000
     
    
  • problem with the insert statement

    Hi all

    I'm trying to insert data into xxops_forecast_extract.
    There are two additional territory_id, position_id columns.
    How can I insert data into xxops_forecast_extract with the update instructions below.
           Columns of XXOPS_FORECAST_EXTRACT 
    
            PERIOD_ORDER,           
            SHR_NODE_ID,         
            FORECAST_DEFN_ID,       
            X_SALES_REP_NUM,        
            X_SALES_REP_REF,        
            POSITION_NAME,          
            TERRITORY_NAME,         
            AM_ID,              
            POSITION_LEVEL,         
            FORECAST_ID,            
            PERIOD_ID,              
            FISCAL_PERIOD,         
            PERIOD_START_DATE,      
            PERIOD_END_DATE,        
            TOTAL_COMMIT_PRODUCT,   
            TOTAL_JUDGMENT_PRODUCT,
            TOTAL_COMMIT_SERVICE,   
            TOTAL_JUDGMENT_SERVICE,
            TOTAL_UPSIDE_PRODUCT,   
            TOTAL_UPSIDE_SERVICE, 
            TERRITORY_ID,
            POSITION_ID
        INSERT INTO xxfdev.xxops_forecast_extract(
            PERIOD_ORDER,           
            SHR_NODE_ID,         
            FORECAST_DEFN_ID,       
            X_SALES_REP_NUM,        
            X_SALES_REP_REF,        
            POSITION_NAME,          
            TERRITORY_NAME,         
            AM_ID,              
            POSITION_LEVEL,         
            FORECAST_ID,            
            PERIOD_ID,              
            FISCAL_PERIOD,         
            PERIOD_START_DATE,      
            PERIOD_END_DATE,        
            TOTAL_COMMIT_PRODUCT,   
            TOTAL_JUDGMENT_PRODUCT,
            TOTAL_COMMIT_SERVICE,   
            TOTAL_JUDGMENT_SERVICE,
            TOTAL_UPSIDE_PRODUCT,   
            TOTAL_UPSIDE_SERVICE )
        SELECT 
            PERIOD_ORDER,           
            NODE_REFERENCE,         
            FORECAST_DEFN_ID,       
            X_SALES_REP_NUM,        
            X_SALES_REP_REF,        
            POSITION_NAME,          
            TERRITORY_NAME,         
            AM_NAME1,               
            POSITION_LEVEL,         
            FORECAST_ID,            
            PERIOD_ID,              
            FISCAL_PERIOD,          
            PERIOD_START_DATE,      
            PERIOD_END_DATE,        
            TOTAL_COMMIT_PRODUCT,   
            TOTAL_JUDGMENT_PRODUCT,
            TOTAL_COMMIT_SERVICE,   
            TOTAL_JUDGMENT_SERVICE,
            TOTAL_UPSIDE_PRODUCT,   
            TOTAL_UPSIDE_SERVICE   
        FROM ESALESFCST.OMF_FORECAST_DATA_FDEV@XXG2C_ECRMS_FDEV_ADMIN.COMPANY.COM;
    
          
         UPDATE xxops_forecast_extract b SET territory_id = (SELECT a.territory_id
             FROM fdev_hier_node_mv a
             WHERE a.shr_node_id = b.shr_node_id
              AND NVL(end_dt,SYSDATE) > SYSDATE) ;
        COMMIT; 
        
        UPDATE xxops_forecast_extract b SET position_id = (SELECT a.row_id 
            FROM s_postn a
            WHERE a.name = 'TD-'||UPPER(b.am_id))
            WHERE position_level = 7
            AND b.am_id IS NOT NULL; 
        COMMIT; 
        
        UPDATE xxops_forecast_extract b SET position_id = (SELECT a.row_id
            FROM s_postn a
            WHERE UPPER(a.desc_text) = UPPER(TRIM(B.POSITION_NAME)))
            WHERE position_level = 7
            AND b.am_id IS NULL;
        COMMIT;
    Thanks in advance.

    You can try with the merger?

  • Is possible to write the INSERT statement that fills two columns: 'word' and 'sense' of the file text with multiple lines - in each line is followed word that is the meaning?

    Is possible to write the INSERT statement that fills two columns: 'word' and 'sense' of the file text with multiple lines - in each line is followed word that is the meaning?

    Hello

    2796614 wrote:

    Is possible to write the INSERT statement that fills two columns: 'word' and 'sense' of the file text with multiple lines - in each line is followed word that is the meaning?

    Of course, it is possible.  According to what the text file looks like to, you can create an external table that treats the text file as if it were a table.  Otherwise, you can always read the file in PL/SQL, using the utl_file package and INSERT of PL/SQL commands.

    You have problems whatever you wantt?  If so, your zip code and explain what the problem is.

    Whenever you have any questions, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the exact results you want from these data, so that people who want to help you can recreate the problem and test their ideas.  In this case, also post a small sample of the text involved file.

    If you ask about a DML operation, such as INSERT, then INSERT statements, you post should show what looks like the tables before the DML, and the results will be the content of the table changed after the DML.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

  • Procedure with the DML statements that insert values from 1 to 100 in only one table and it is matching word equivalent in the other

    Can someone help me create a procedure with the DML statements that insert values from 1 to 100 in a table "abc" and the procedure must connect the numbers into words in another table "xyz" without doing a commit explicitly. "."

    Currently on trial...

    SQL > create table abc (num number);

    Table created.

    SQL > create table xyz (num varchar2 (100));

    Table created.

    SQL > ed
    A written file afiedt.buf

    1. insert all
    2 values of 1 = 1 then in abc (num) (l)
    3 when the values of 1 = 1 then in xyz (num) (to_char (to_date(l,'j'), 'jsp'))
    4 * Select the level from dual connect by level<=>
    SQL > /.

    200 rows created.

    And the result...

    SQL > select * from abc;

    NUM
    ----------
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    ..
    ..
    ..
    98
    99
    100

    100 selected lines.

    SQL > select * from xyz;

    NUM
    ----------------------------------------------------------------------------------------------------
    one
    two
    three
    four
    five
    six
    seven
    eight
    nine
    ten
    Eleven
    twelve
    ..
    ..
    ..
    98
    Nineteen eighty
    Cent

    100 selected lines.

  • Question related to the INSERT statement

    Imagine this scenario:

    -table_a has 5 000 000 records at time t1

    -table_b is empty at time t1

    -At time t1, I execute the following statement:
              insert into table_b
                select * from table_a;
        
    -L' insert statement ends in time t2

    -Between t1 and t2, say 3 000 new records have been added to the table_a (by OLTP processes).
    Thus, at time t2, table_a has 5 003 000 records.

    My question is, at time t2, the number of records will be in table_b? Will it 5,000,000 or
    5 003 000 or somewhere between these two counts?

    I guess it will be 5,000,000 because that is the number when the insert statement
    has started to run.

    Any comment is appreciated.

    Syed Ullah says:
    Imagine this scenario:

    -table_a has 5 000 000 records at time t1

    -table_b is empty at time t1

    -At time t1, I execute the following statement:

    insert into table_b
    select * from table_a;
    

    -L' insert statement ends in time t2

    -Between t1 and t2, say 3 000 new records have been added to the table_a (by OLTP processes).
    Thus, at time t2, table_a has 5 003 000 records.

    My question is, at time t2, the number of records will be in table_b? Will it 5,000,000 or
    5 003 000 or somewhere between these two counts?

    I guess it will be 5,000,000 because that is the number when the insert statement
    has started to run.

    Any comment is appreciated.

    At time t2, it is possible that the answer is 0. Once the insert operation finishes (can be any time after t1 in your example, possibly before t2, possibly after) and assuming you checked in the same session where you run the insert, you would see 5 000 000. In other sessions you would continue to see 0 up to what the session who made the done insert one COMMIT.

    http://docs.Oracle.com/CD/E11882_01/server.112/e25789/consist.htm#CNCPT121

    Is something that you should read. He described these concepts much better than what you'll probably find in a few posts on the forum.

  • 0xC000021A {fatal system error}, the initial session process or the process of the complete system in unexpected ways with the blocking state 0 x 00000000 (0xc0000034 0x001008ac) the system has been halted

    Hello! I got this message from malware (I clicked to delete) in surfing on firefox and after awhile the explorer.exe closes with an error. I try to open the Task Manager and it says explore cannot be found!
    I rebooted and then I got this message "0xC000021A {fatal system error}, the initial session process or the process of the complete system in unexpected ways with the blocking state 0 x 00000000 (0xc0000034 0x001008ac) the system has been halted" and can't get anywhere.
    I can't even go in safe mode, the same error messages appears.

    Hi James,

    You could try the Startup Repair to see if it solves the problem:

    http://Windows.Microsoft.com/en-us/Windows-Vista/startup-repair-frequently-asked-questions

    Chris
    Microsoft Answers Support Engineer
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • need help to create the insert statement

    I have customer_priv of table which has 4 columns (login, privilize_id, adate, added_by)

    the stmt insert like "insert into customer_priv values('JDOE',951.sysdate,admin);

    I have 100 users and for each user, I need to add to the 15 privilize_id

    I have the list of connections and roles, what is the best way to create a massive insert for all those users statement and

    any help is very appreciated

    Thank you

    user11984714 wrote:
    Thanks Frank

    I get the below now.what Miss. Also is it possible to reel in a file insert rather directly the data.am I missing values?

    Sorry, I don't understand what you want.
    You say you want to write something in a HOLD file instead of insert? Of course, you can do it. Change the INSERT statement in a SELECT statement and add commands to the COIL.

    SQL > @c:\insert_many.sql
    33 old: SELECT ' & 1' priv_id, 'admin', sysdate)
    33 News: SELECT sysdate, "BNELSON", "admin", priv_id)

    Of all_priv_id
    *
    ERROR on line 34:
    ORA-00923: THE KEYWORD not found where expected
    Thank you

    Published by: user11984714 on August 9, 2010 18:40

    Sorry, there was a typing error in my previous post.
    Remove the ')' the end of the

    SELECT     '&1', privilze_id, SYSDATE, 'admin')
    

    I hope that you have more problems, but if you do, post your code, even if you think that you just copied it from this site.

  • need help with the Update statement

    Hello
    I received a question in a course and I tried my best to respond, and now my brain is giving. I would really appreciate help with the update statement. I don't mind if you do not validate a solution, a little nudge in the right direction would be really useful. I'll post that I got.

    THE QUESTION
    / * For these agents disabled on more than seven missions, change their date of deactivation of the first date of deactivation of all the agents that have been activated in the same year as the agent that you update currently.
    */

    I have it divided into parts, here is my select statement to agents disabled on more than 7 missions, which produces the deactivation_dates in the agents table that I want to update...
    SELECT
    s.deactivation_date
    FROM
    (
    SELECT
    a.deactivation_date,
    count(m.mission_id) as nomissions
    FROM
    agents a
    INNER JOIN
    missions_agents m
    on
    a.agent_id=m.agent_id
    GROUP BY
    a.deactivation_date
    ) s
    WHERE
    s.nomissions>7 AND s.deactivation_date IS NOT NULL
    .. .and the code for the first date of deactivation for each year of activation agent
    select 
    a2.deactivation_date
    from
    agents a2
    where a2.deactivation_date= 
    (
    select min(a.deactivation_date)
    from 
    agents a
    where to_number(to_char(a.activation_date,'YYYY'))=to_number(to_char(a2.activation_date,'YYYY'))
    )
    ..... I am not real to marry these two statements together in the Update statement. I can't extract each date of deactivation produced in the first select statement and their match against the first date of deactivation in the year they have been activated for the second select statement.

    Any help greatly appreciated... :))

    I began to wonder how things would :)

    user8695469 wrote:
    First of all why he chooses the date the earliest of all agents

    UPDATE  AGENTS_COPY AC /* (1) */
    SET     DEACTIVATION_DATE = (
    SELECT  MIN(AGS.DEACTIVATION_DATE)
    FROM    AGENTS_COPY  AGS
    ,       AGENTS_COPY AC /* (2) */
    WHERE   TRUNC(AGS.ACTIVATION_DATE,'YEAR') = TRUNC(AC.ACTIVATION_DATE,'YEAR') /* (3) */
    )
    

    He recovers as soon as the subquery has not been correctly set in the SET clause. It seems you are trying to update a correlated, but we are still having a conceptual shift. I have added a few comments to your code above and below will explain.

    (1): when you do a correlated update it is useful to the table alias that you did right here.

    (2): this table statement is not necessary and is the reason why the FIRST deactivation date is selected. The alias that you use (3) refers to THIS table, not the one defined in the update statement. Remove the line indicated by (2) in the FROM clause and a correlated update will happen.

    and secondly why is it to update each row, when I thought that I'm just the lines where the agents are disabled and missions > 7? Pointers on where I'm wrong would be very appreciated. (SQL = stupid query language!) :)

    user8695469 wrote: then why is it to update each row, when I thought that I'm just the lines where the agents are disabled and missions > 7? Pointers on where I'm wrong would be very appreciated. (SQL = stupid query language!) :)

    
    WHERE EXISTS
    (
    SELECT
    a.agent_id,
    count(m.mission_id)
    FROM
    agents a
    /* INNER JOIN AC ON AC.AGENT_ID = A.AGENT_ID */
    INNER JOIN
    missions_agents m
    ON
    a.agent_id=m.agent_id
    GROUP BY
    a.agent_id,
    a.deactivation_date
    HAVING
    count(m.mission_id)>7 AND a.deactivation_date IS NOT NULL
    )
    

    Once again this problem is similar to the question above that a correlation update doesn't work. Test existence of lines in an EXISTS subquery. Since your subquery is not related to the table that you are trying to update, it will be always return a line and, therefore, it returns true for EACH LINE in the AGENTS table. To limit the game to only agents > 7 missions results, you need to add a join condition that references the table in your update statement. I added one above (with comments) as a sample.

    I recommend you look over all material that you have associated with correlated subqueries, including documents that I posted above. This seems to be what you're having the problem more with. If you need me to explain the concept of correlated queries any better please let me know.

    Thank you!

  • High power house with the MHC-GT4D Bluetooth Audio System.

    I'm in VietNam. I like

    High power house with the MHC-GT4D Bluetooth Audio System.

    How can I buy it?

    Pls help.

    Thank you.

    Hi NGUYENTUANHOA,

    Welcome to the community of Sony!

    For further assistance about your concern, please contact the representative offices of offices/Sony Sony nearest your place of residence in the Asia-Pacific region http://www.sony-asia.com/countryselector.html?hpid=countryselector:AsiaPacific. Due to the proximity, they are in a better position to respond to your questions or concerns.

    Best regards
    -Mark

    If my post answered your question, please mark it as "accept as a Solution.

  • Looking for a better style or a way to write the INSERT statement, possible with brand of continuation

    Honestly, I really looked everywhere for this.

    The problem is that, while tinkering in SQL Developer and knowing that in the spreadsheet I can just execute individual instructions by placing the cursor on the SQL statement I want to run I tried to do an INSERT query that would allow me to run an INSERT statement for... Well many inserts.

    I thought I could use a brand of continuation but nothing I've tried has worked.

    INSERT INTO

    HF_easy_drinks

    VALUES

    ("Blackthorn", "tonic water", 1.5, 1.0, "pineapple juice", "mix with ice").

    ("Blue Moon", "soda", 1.5 "Blueberry Juice",. 75, "mix with ice, strain")

    ;


    I ended up doing just individual INSERT statements, which was not as convenient.

    INSERT INTO HF_easy_drinks

    VALUES ('Blackthorn', 'tonic water', 1.5, 1.0, "pineapple juice", "mix with ice");

    INSERT INTO HF_easy_drinks

    VALUES ('Blue Moon', 'soda', 1.5, 'Blueberry Juice',. 75, "mix with ice");

    Hello

    Perhaps you might prefer "an" insert like this:

    INSERT INTO hf_easy_drinks (x, y, z,...)
    SELECT "Blackthorn", "tonic water", 1.5, 1.0, "pineapple juice", "mix with ice" OF THE double
    UNION ALL SELECT 'Blue Moon', 'soda', 1.5, 'Blueberry Juice',. 75, "mix with ice, strain ' FROM dual
    SELECT UNION ALL... OF the double
    SELECT UNION ALL... OF the double
    ;

    Best regards

    Bruno Vroman.

  • OSB: fn - bea: execute - sql () with the sql statement ' INSERT INTO...» »

    Dear Experts,

    I need a clarification. Is it possible to use the fn - bea: function execute sql (Oracle Service Bus) to perform an insert operation in a database with the data extracted from the message of the Organization (i.e. $body/Info/username)? If it is possible which is the right syntax?
    Any suggestion is appreciated.

    Kind regards
    Mike

    Published by: ITDeveloper on November 19, 2009 2.55

    Published by: ITDeveloper on November 19, 2009 3.01

    Hi Mike,.

    Please refer to my post for the same question to the fn - bea: sql performance with 'Insert INTO' the sql statement

    Thank you best regards &,.

    Vivek

  • Question about the use of sequence in the INSERT statement

    Hello
    I have a problem with inserting data into a table. I created a sequence...
    CREATE SEQUENCE ag_in_target_seq
    INCREMENT BY 1 
    START WITH 1
    ;
    and Im trying to use it to insert an incrementing ID value in a column for the newly created table. Im getting an error message regarding the sequence.
    "The specified sequence (CURRVAL and NEXTVAL) number is inappropriate here in education."
    I just started looking at sequences, but not sure of my logic or syntax. (little a noob). If someone could point me in the right direction it would be much appreciated. Thanks to a witness of anomaly.
    INSERT INTO AGENTSINFOTARGET
    SELECT     
               a.code_name,
               i.information_id,
               i.gleaned_date,
               t.first_name,
               t.last_name,
               l.description,
               ag_in_target_seq.nextval
    FROM
               agents a
               INNER JOIN
               information i ON
               a.agent_id=i.agent_id
               INNER JOIN
               targets t ON
               i.target_id=t.target_id
               INNER JOIN
               locations l on
               t.location_id=l.location_id
               ORDER BY
               a.code_name desc 
      ;

    remove the order by clause. Or if you really want to match the id with the name, and then apply the sequence after you ordered.

    not tested

    INSERT INTO AGENTSINFOTARGET
    select s.code_name, s.information_id, s.gleaned_date, s.first_name, s.last_name, s.description
            ,ag_in_target_seq.nextval
    from
      (SELECT
               a.code_name, i.information_id, i.gleaned_date, t.first_name, t.last_name, l.description
      FROM  agents a
      JOIN information i ON a.agent_id=i.agent_id
      JOIN targets t ON i.target_id=t.target_id
      JOIN locations l on t.location_id=l.location_id
      ORDER BY a.code_name desc
      ) s
    ;
    

    But without an order by clause, it would be much better.
    This sequence if he lies later as a primary key, then there is no logical reason for any specific order.

    Published by: Sven w. on August 13, 2009 15:39

    Published by: Sven w. on August 13, 2009 15:43 - readbility improved statement

  • logical AND with the structure of the event

    Hello world

    The structure of the event can manage several events at once to do the same thing: looks like an OR logical operator. But I have not found a way to sequence events to approach a logic and example: you must click on a button to draw, then enter the image would change the mouse cursor. With a structure of the event, I can handle these 2 events separately or together (i.e. change the cursor), but I can't do a sequence of events.

    Is this possible to do with a structure of the event?

    I hope that I am clear (sorry for English btw). And thanks in advance.

    Christophe

    I don't think this is possible directly. You will need to add status information to your event loop that could enforce the order of events and the rules of logic you want. Where transformation you would have to check whether the required event has occurred before this event. If that were the case, perform your treatment. If this isn't the case, ignore the event. Your first event would need set this status information. You can also include some kind of time-out for the second event were to occur within a specific period.

    This type of logic may be better treated with the help of producer/consumer architecture and a state machine in the task of the consumer.

Maybe you are looking for