My cursor is blocking table Inserts

I have a function that copies any new rows from Database_A, Table_A to Database_B, Table_A via a database link. This happens periodically, and there can be around 100k new records accumulated in between these periods.
I gather the records which need to be copied by filtering on a "copied" field on the table. Within the loop, I update the row's copied field so it won't be copied during the next pass. Here's the function:
FUNCTION copy_records RETURN INTEGER IS
     pCount INTEGER := 0;       
        CURSOR recs IS
            SELECT * FROM TABLE_A
            WHERE FLG_COPIED = 'N' OR FLG_COPIED IS NULL
            ORDER BY MYKEY;    -- do the oldest first (only important if we commit during iterations)             
    BEGIN
        pCount := 0;
        FOR rec IN recs LOOP
            -- first copy to backup db
            INSERT INTO TABLE_A@BACKUP_DB
                (FIELD_1, FIELD_2, FIELD_3)
            VALUES
                (rec.FIELD_1, rec.FIELD_2, rec.FIELD_3);
            -- now flag as copied
            UPDATE TABLE_A
            SET FLG_COPIED = 'Y'
            WHERE MYKEY = rec.MYKEY;
            -- counter sent back for logging
            pCount := pCount + 1;              
        END LOOP;
        RETURN pCount;
    EXCEPTION
        WHEN OTHERS THEN
            RETURN SQLCODE;
    END;
END;My problem is that it is blocking on the table while this process takes place. I would expect some row-level blocking, which is fine (this table is primarily INSERT only). But I'm not sure why it blocks such that it won't allow me to INSERT into the table. Can anyone explain this to me?
If I do a COMMIT during each iteration, I can at least perform an Insert, but this seems to slow things down greatly when used across a DBLink, so I'd like to avoid it (plus I wish to make this function an all-or-none transaction). I'm also not sure if the effect of the COMMIT is to make the block row-only, or just minimize the window of the table locking.
Edited by: xaeryan on Oct 14, 2011 3:51 PM

xaeryan wrote:
Solomon Yakobson wrote:
xaeryan wrote:
My problem is that it is blocking on the table while this process takes place.No it is not. Based on your code all it is locking are table TABLE_A rows it updates. So if any other session tries to update/delete rows updated by your function such session will wait till you commit/rollback. If any other session tries to update/delete rows NOT updated by your function such session will NOT wait.
SY.Based on my observations, it is - when I try to perform an INSERT while the function is running, it will not complete. I can see in Toad that there is a row-level lock for my function which is NOT blocking, however there is also a transaction level lock associated with the same session ID which is listed as blocking. There's not much more detail on that one in Toad.
Is there anything in Oracle that might do something unexpected when your cursor selects the majority of the records? Like optimization for performance that might involve blocking? It seems silly, I know, but I can't seem to understand why this function stops any use of this table.how can we reproduce what you report?

Similar Messages

  • Can't insert recors fetched by cursor in the table

    HI
    i am fetching records from my table total_budget.All the fetched records are displayed in a tabular data block(data block name is forecast_result).Now i want to insert these record fetched by cursor in my table forecast_resul which is empty.how can i do it.I am sending the code if any one can help............
    When i execute this code it give me error unable to insert(FRM-40508) .I have carefully checked table columns names and their data types.All r fine but i dont know y it is not working.Here is the code
    DECLARE
    cursor c1 IS
    SELECT ministry_id,fiscal_year ,t_amount
    FROM total_budget
    WHERE ministry_id=:global.var11 AND (fiscal_year BETWEEN :syear and :eyear);
    BEGIN
    T_XSUMX := 0;
         OPEN C1;
         X:=1;
         SUMX := 0; SUMY := 0; SUMXY:=0; SUMX2 := 0;
         go_block('forecast_result');
         first_record;
         LOOP
              FETCH C1 INTO Y1,Y2,Y;
              EXIT WHEN C1%NOTFOUND;
              SUMY := SUMY +Y;
              XY := X*Y;
              X2 := X*X;
              SUMX := SUMX + X;
    SUMXY := SUMXY + XY;
              SUMX2 := SUMX2 + X2;
                   :forecast_result.ministry_id:=Y1;
                   :forecast_result.fiscal_year:=Y2;
              :forecast_result.t_amount:=Y;
         NEXT_RECORD;
              X := X + 1;
         END LOOP;
         close C1;
    z:=X-2;
         X_BAR := z;
         X := z+1;
         T_XSUMX := X * SUMX;
         T_SUMY := SUMY * SUMX;
         T_SUMX := SUMX * SUMX;
         T_SUMXY := SUMXY * X;
         T_SUMX2 := SUMX2 * X;
         R1 := T_SUMY - T_SUMXY;
         R2 := T_SUMX - T_SUMX2;
         B := ROUND(R1/R2,1);
         A := ROUND((T_SUMXY -(T_SUMX2*B))/T_XSUMX,1);
         Y_BAR := A+(B*X_BAR);
    :forecast_result.ministry_id:=Y1;
    :forecast_result.fiscal_year:=Y2;
    :forecast_result.t_amount:=Y_BAR;
    next_record;
         insert into forecast_result
         values(:forecast_result.ministry_id,:forecast_result.fiscal_year,:forecast_result.t_amount);
         commit;
    END;
    Can anyone tell me wat i am doing wrong
    looking for instant reply
    nida

    Hi alma,
    Plz u dnt wrt babytalk rr SMS-language -> mi! Becoz mi don lejk dat.
    I suppose that your data block "forecast_result" are based on the table of the same name. Otherwise this may be the cause of some of your trouble.
    Your code would properly work better like this:
    DECLARE
      X NUMBER(38);
      SUMX NUMBER(38);
      SUMY NUMBER(38);
      Y NUMBER(38) ;
      Y1 varchar2(10);
      Y2 varchar2(10);
      X2 NUMBER(38);
      XY NUMBER(38);
      SUMXY NUMBER(38);
      SUMX2 NUMBER(38);
      X_BAR NUMBER(38);
      Y_BAR NUMBER(38);
      T_SUMY NUMBER(38);
      T_SUMX NUMBER(38);
      T_SUMXY NUMBER(38);
      T_SUMX2 NUMBER(38);
      T_XSUMX NUMBER(38);
      R1 NUMBER(38);
      R2 NUMBER(38);
      A NUMBER(38);
      z number(38);
      B NUMBER(38);
      final number(38);
      -- Just curious, where does :syear and :eyear come from ??
      cursor c1 IS
       SELECT ministry_id, fiscal_year, t_amount
        FROM total_budget
       WHERE ministry_id=:global.var11
         AND (fiscal_year BETWEEN :syear and :eyear);
    BEGIN
      T_XSUMX := 0;
      X:=1;
      SUMX := 0;
      SUMY := 0;
      SUMXY:=0;
      SUMX2 := 0;
      go_block('forecast_result');
      -- If you're making this dynamically, then clear the block to start with.
      clear_block(NO_COMMIT);
      first_record;
      OPEN C1;
      LOOP
        FETCH C1 INTO Y1, Y2, Y;
        EXIT WHEN C1%NOTFOUND;
        SUMY := SUMY + Y;
        XY := X*Y;
        X2 := X*X;
        SUMX := SUMX + X;
        SUMXY := SUMXY + XY;
        SUMX2 := SUMX2 + X2;
        :forecast_result.ministry_id := Y1;
        :forecast_result.fiscal_year := Y2;
        :forecast_result.t_amount := Y;
        -- NO, this will not work. You have to CREATE the record. You only get the
        -- first record for "free". Next_Record moves to allready existing records.
        -- NEXT_RECORD;
        Create_Record;
        X := X + 1;
      END LOOP;
      close C1;
      z := X - 2;
      X_BAR := z;
      X := z + 1;
      T_XSUMX := X * SUMX;
      T_SUMY := SUMY * SUMX;
      T_SUMX := SUMX * SUMX;
      T_SUMXY := SUMXY * X;
      T_SUMX2 := SUMX2 * X;
      R1 := T_SUMY - T_SUMXY;
      R2 := T_SUMX - T_SUMX2;
      B := ROUND(R1/R2,1);
      A := ROUND((T_SUMXY -(T_SUMX2*B))/T_XSUMX,1);
      Y_BAR := A+(B*X_BAR);
      -- What are you doing here ?? This is weird. The population of the records are done in
      -- the loop ! You don't have to add anything here.
      -- :forecast_result.ministry_id:=Y1;
      -- :forecast_result.fiscal_year:=Y2;
      -- :forecast_result.t_amount:=Y_BAR;
      -- Since your data block (hopefully) are based on the table of the same name, you DON'T
      -- need to do this. You just have to press the commit button (or F10 or the floppy disk
      -- icon or what-ever).
      -- insert into forecast_result
      -- values(:forecast_result.ministry_id,:forecast_result.fiscal_year,:forecast_result.t_amount);
      -- commit;
    END;

  • Inserting values from a cursor to a table

    Hi,
    I need to insert the values from a cursor into a table,this i the part of code which trieds to do it...i get error stating "select stmt missing"...pls help out...
    OPEN  p_cursor for V_SQLSTATEMENT;
            ---for i in p_cursor
            LOOP
              FETCH p_cursor INTO v_cursor_type;      
              insert into TEMPCHARTVALUES(HOP,AMOUNT,EFFECTIVE_FROM,EFFECTIVE_TO,CURRENCY)
                   values (v_cursor_type.PMC1_HOP_CODE,
                         v_cursor_type.PMC1_Amount,
                         v_cursor_type.PMC1_EFFECTIVE_FROM,
                         v_cursor_type.PMC1_EFFECTIVE_UPTO,
                         v_cursor_type.PMC1_CURRENCY);
                                                           --dbms_output.put_line(v_cursor_type.KEYCODE1);
              EXIT WHEN p_cursor%ROWCOUNT = v_REC_COUNT;
              end loop;

    Hi, here it is..
    create or replace
    procedure  prm_sp_charts_db (P_CURSOR OUT SYS_REFCURSOR,CHARTCode VARCHAR,tablename varchar)
    IS
    v_COUNT varchar2(200);
    v_REC_COUNT NUMBER;
    V_SQLSTATEMENT VARCHAR2(2000);
    v_cursor_type  TEMPCHARTVALUES%ROWTYPE;
        begin
         v_COUNT:='SELECT COUNT(*) FROM PRM_M_Chart_' || CHARTCode;
         execute immediate v_COUNT into v_REC_COUNT;
         V_SQLSTATEMENT := 'SELECT ';
         V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F1_CODE Keycode1,';
          open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F2_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F2_CODE Keycode2,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F3_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F3_CODE Keycode3,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
           open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F4_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F4_CODE Keycode4,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F5_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F5_CODE Keycode5,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          --open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F6_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F6_CODE Keycode6,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          --open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F7_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F7_CODE Keycode7,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          --open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F8_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F8_CODE Keycode8,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          --open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F9_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F9_CODE Keycode9,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          --open  P_CURSOR for select column_name from  user_tab_columns where table_name=tablename and column_name='PMC' || CHARTCode || '_F10_CODE';
          IF P_CURSOR%FOUND then
          V_SQLSTATEMENT := V_SQLSTATEMENT || 'PMC' || CHARTCode || '_F10_CODE Keycode10,';
          else
          V_SQLSTATEMENT := V_SQLSTATEMENT || '0,';
          END IF;
          V_SQLSTATEMENT := V_SQLSTATEMENT ||'PMC' || CHARTCode || '_HOP_CODE HOPCode,PMC' || CHARTCode || '_AMOUNT ,PMC'|| CHARTCode || '_EFFECTIVE_FROM Effective_From,PMC' || CHARTCode || '_EFFECTIVE_UPTO Effective_Upto,PMC' || CHARTCode || '_CURRENCY Currency FROM PRM_M_CHART_' || CHARTCode ;
          DBMS_OUTPUT.PUT_LINE(V_SQLSTATEMENT);
           OPEN  p_cursor for V_SQLSTATEMENT;
            ---for i in p_cursor
            LOOP
              FETCH p_cursor INTO v_cursor_type;      
              insert into TEMPCHARTVALUES(HOP,AMOUNT,EFFECTIVE_FROM,EFFECTIVE_TO,CURRENCY)
                   values (v_cursor_type.PMC1_HOP_CODE,
                         v_cursor_type.PMC1_Amount,
                         v_cursor_type.PMC1_EFFECTIVE_FROM,
                         v_cursor_type.PMC1_EFFECTIVE_UPTO,
                         v_cursor_type.PMC1_CURRENCY);
                                                           --dbms_output.put_line(v_cursor_type.KEYCODE1);
              EXIT WHEN p_cursor%ROWCOUNT = v_REC_COUNT;
              end loop;
    end prm_sp_charts_db;

  • Any general tips on getting better performance out of multi table insert?

    I have been struggling with coding a multi table insert which is the first time I ever use one and my Oracle skills are pretty poor in general so now that the query is built and works fine I am sad to see its quite slow.
    I have checked numerous articles on optimizing but the things I try dont seem to get me much better performance.
    First let me describe my scenario to see if you agree that my performance is slow...
    its an insert all command, which ends up inserting into 5 separate tables, conditionally (at least 4 inserts, sometimes 5 but the fifth is the smallest table). Some stats on these tables as follows:
    Source table: 5.3M rows, ~150 columns wide. Parallel degree 4. everything else default.
    Target table 1: 0 rows, 27 columns wide. Parallel 4. everything else default.
    Target table 2: 0 rows, 63 columns wide. Parallel 4. default.
    Target table 3: 0 rows, 33 columns wide. Parallel 4. default.
    Target table 4: 0 rows, 9 columns wide. Parallel 4. default.
    Target table 5: 0 rows, 13 columns wide. Parallel 4. default.
    The parallelism is just about the only customization I myself have done. Why 4? I dont know it's pretty arbitrary to be honest.
    Indexes?
    Table 1 has 3 index + PK.
    Table 2 has 0 index + FK + PK.
    Table 3 has 4 index + FK + PK
    Table 4 has 3 index + FK + PK
    Table 5 has 4 index + FK + PK
    None of the indexes are anything crazy, maybe 3 or 4 of all of them are on multiple columns, 2-3 max. The rest are on single columns.
    The query itself looks something like this:
    insert /*+ append */ all
    when 1=1 then
    into table1 (...) values (...)
    into table2 (...) values (...)
    when a=b then
    into table3 (...) values (...)
    when a=c then
    into table3 (...) values (...)
    when p=q then
    into table4(...) values (...)
    when x=y then
    into table5(...) values (...)
    select .... from source_table
    Hints I tried are with append, without append, and parallel (though adding parallel seemed to make the query behave in serial, according to my session browser).
    Now for the performance:
    It does about 8,000 rows per minute on table1. So that means it should also have that much in table2, table3 and table4, and then a subset of that in table5.
    Does that seem normal or am I expecting too much?
    I find articles talking about millions of rows per minute... Obviously i dont think I can achieve that much... but maybe 30k or so on each table is a reasonable goal?
    If it seems my performance is slow, what else do you think I should try? Is there any information I may try to get to see if maybe its a poorly configured database for this?
    P.S. Is it possible I can run this so that it commits every x rows or something? I had the heartbreaking event of a network issue giving me this sudden "ora-25402: transaction must roll back" after it was running for 3.5 hours. So I lost all the progress it made... have to start over. plus i wonder if the sheer amount of data being queued for commit/rollback is causing some of the problem?
    Edited by: trant on Jun 27, 2011 9:29 PM

    Looks like there are about 54 sessions on my database, 7 of the sessions belong to me (2 taken by TOAD and 4 by my parallel slave sessions and 1 by the master of those 4)
    In v$session_event there are 546 rows, if i filter it to the SIDs of my current session and order my micro_wait_time desc:
    510     events in waitclass Other     30670     9161     329759     10.75     196     3297590639     1736664284     1893977003     0     Other
    512     events in waitclass Other     32428     10920     329728     10.17     196     3297276553     1736664284     1893977003     0     Other
    243     events in waitclass Other     21513     5     329594     15.32     196     3295935977     1736664284     1893977003     0     Other
    223     events in waitclass Other     21570     52     329590     15.28     196     3295898897     1736664284     1893977003     0     Other
    241     row cache lock     1273669     0     42137     0.03     267     421374408     1714089451     3875070507     4     Concurrency
    241     events in waitclass Other     614793     0     34266     0.06     12     342660764     1736664284     1893977003     0     Other
    241     db file sequential read     13323     0     3948     0.3     13     39475015     2652584166     1740759767     8     User I/O
    241     SQL*Net message from client     7     0     1608     229.65     1566     16075283     1421975091     2723168908     6     Idle
    241     log file switch completion     83     0     459     5.54     73     4594763     3834950329     3290255840     2     Configuration
    241     gc current grant 2-way     5023     0     159     0.03     0     1591377     2685450749     3871361733     11     Cluster
    241     os thread startup     4     0     55     13.82     26     552895     86156091     3875070507     4     Concurrency
    241     enq: HW - contention     574     0     38     0.07     0     378395     1645217925     3290255840     2     Configuration
    512     PX Deq: Execution Msg     3     0     28     9.45     28     283374     98582416     2723168908     6     Idle
    243     PX Deq: Execution Msg     3     0     27     9.1     27     272983     98582416     2723168908     6     Idle
    223     PX Deq: Execution Msg     3     0     25     8.26     24     247673     98582416     2723168908     6     Idle
    510     PX Deq: Execution Msg     3     0     24     7.86     23     235777     98582416     2723168908     6     Idle
    243     PX Deq Credit: need buffer     1     0     17     17.2     17     171964     2267953574     2723168908     6     Idle
    223     PX Deq Credit: need buffer     1     0     16     15.92     16     159230     2267953574     2723168908     6     Idle
    512     PX Deq Credit: need buffer     1     0     16     15.84     16     158420     2267953574     2723168908     6     Idle
    510     direct path read     360     0     15     0.04     4     153411     3926164927     1740759767     8     User I/O
    243     direct path read     352     0     13     0.04     6     134188     3926164927     1740759767     8     User I/O
    223     direct path read     359     0     13     0.04     5     129859     3926164927     1740759767     8     User I/O
    241     PX Deq: Execute Reply     6     0     13     2.12     10     127246     2599037852     2723168908     6     Idle
    510     PX Deq Credit: need buffer     1     0     12     12.28     12     122777     2267953574     2723168908     6     Idle
    512     direct path read     351     0     12     0.03     5     121579     3926164927     1740759767     8     User I/O
    241     PX Deq: Parse Reply     7     0     9     1.28     6     89348     4255662421     2723168908     6     Idle
    241     SQL*Net break/reset to client     2     0     6     2.91     6     58253     1963888671     4217450380     1     Application
    241     log file sync     1     0     5     5.14     5     51417     1328744198     3386400367     5     Commit
    510     cursor: pin S wait on X     3     2     2     0.83     1     24922     1729366244     3875070507     4     Concurrency
    512     cursor: pin S wait on X     2     2     2     1.07     1     21407     1729366244     3875070507     4     Concurrency
    243     cursor: pin S wait on X     2     2     2     1.06     1     21251     1729366244     3875070507     4     Concurrency
    241     library cache lock     29     0     1     0.05     0     13228     916468430     3875070507     4     Concurrency
    241     PX Deq: Join ACK     4     0     0     0.07     0     2789     4205438796     2723168908     6     Idle
    241     SQL*Net more data from client     6     0     0     0.04     0     2474     3530226808     2000153315     7     Network
    241     gc current block 2-way     5     0     0     0.04     0     2090     111015833     3871361733     11     Cluster
    241     enq: KO - fast object checkpoint     4     0     0     0.04     0     1735     4205197519     4217450380     1     Application
    241     gc current grant busy     4     0     0     0.03     0     1337     2277737081     3871361733     11     Cluster
    241     gc cr block 2-way     1     0     0     0.06     0     586     737661873     3871361733     11     Cluster
    223     db file sequential read     1     0     0     0.05     0     461     2652584166     1740759767     8     User I/O
    223     gc current block 2-way     1     0     0     0.05     0     452     111015833     3871361733     11     Cluster
    241     latch: row cache objects     2     0     0     0.02     0     434     1117386924     3875070507     4     Concurrency
    241     enq: TM - contention     1     0     0     0.04     0     379     668627480     4217450380     1     Application
    512     PX Deq: Msg Fragment     4     0     0     0.01     0     269     77145095     2723168908     6     Idle
    241     latch: library cache     3     0     0     0.01     0     243     589947255     3875070507     4     Concurrency
    510     PX Deq: Msg Fragment     3     0     0     0.01     0     215     77145095     2723168908     6     Idle
    223     PX Deq: Msg Fragment     4     0     0     0     0     145     77145095     2723168908     6     Idle
    241     buffer busy waits     1     0     0     0.01     0     142     2161531084     3875070507     4     Concurrency
    243     PX Deq: Msg Fragment     2     0     0     0     0     84     77145095     2723168908     6     Idle
    241     latch: cache buffers chains     4     0     0     0     0     73     2779959231     3875070507     4     Concurrency
    241     SQL*Net message to client     7     0     0     0     0     51     2067390145     2000153315     7     Network
    (yikes, is there a way to wrap that in equivalent of other forums' tag?)
    v$session_wait;
    223     835     PX Deq Credit: send blkd     sleeptime/senderid     268697599     000000001003FFFF     passes     1     0000000000000001     qref     0     00     1893977003     0     Other     0     10     WAITING
    241     22819     row cache lock     cache id     13     000000000000000D     mode     0     00     request     5     0000000000000005     3875070507     4     Concurrency     -1     0     WAITED SHORT TIME
    243     747     PX Deq Credit: send blkd     sleeptime/senderid     268697599     000000001003FFFF     passes     1     0000000000000001     qref     0     00     1893977003     0     Other     0     7     WAITING
    510     10729     PX Deq Credit: send blkd     sleeptime/senderid     268697599     000000001003FFFF     passes     1     0000000000000001     qref     0     00     1893977003     0     Other     0     2     WAITING
    512     12718     PX Deq Credit: send blkd     sleeptime/senderid     268697599     000000001003FFFF     passes     1     0000000000000001     qref     0     00     1893977003     0     Other     0     4     WAITING
    v$sess_io:
    223     0     5779     5741     0     0
    241     38773810     2544298     15107     27274891     0
    243     0     5702     5688     0     0
    510     0     5729     5724     0     0
    512     0     5682     5678     0     0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • To Use  Cursor or  TYPE table Index by PLS_integer

    Hi All,
    Let's see if I have table with no. of records 19,26,20,000.
    If I want to loop through all the records which will be a optimized way To Use Cursor or TYPE table Index by PLS_integer.
    Please guide.
    Thanks.

    What is it you want to do to/with the rows you're looping through?
    Ideally you want to avoid looping, as that's row by row (aka slow by slow) processing and it's expensive time-wise.
    If you're doing DML (insert/update/delete) then you're best off doing it in one sql statement, rather than looping.

  • How to delete the duplicate rows present in the parent table & insert the latest duplicate record into the parent table linked with the child table.

    I have a master table and i need to import the rows into the parent and child table.
    Master table name is Flatfile_Inventory
    Parent Table name is INVENTORY
    Child Tables name are INVENTORY_AMOUNT,INVENTORY_DETAILS,INVENTORY_VEHICLE,
    Error details will be goes to LOG_INVENTORY_ERROR
    I have 4 duplicate rows in the Flatfile_Inventory which i have already inserted in the Parent and child table.
    Again when i run the query using stored procedure,
    its tells that all the 4 rows are duplicate and will move to the Log_Inventory_Error.
    I need is if i have the duplicate rows in the flatfile_Inventory when i start inserting into the parent and child table the already inserted row have the unique ID i
    must identify it and delete that row in the both parent and chlid table.And latest row must get inserted into the Parent and child table from Flatfile_Inventory.
    Please help me to write the query i have attached the Full stored procedure Script..
    Arunraj Kumar

    Hi Santhosh,
    This is my Script.
    -- =============================================
    -- Stored Procedure for FLATFILE_INVENTORY
    -- =============================================
    -- Drop stored procedure if it already exists
       DROP PROCEDURE SP_Flatfile_Inventory
    GO
    CREATE PROCEDURE SP_Flatfile_Inventory
    AS
    --USE IconicMarketing
    GO
    DECLARE
    @FileType  varchar(50)  ,
    @ACDealerID  varchar(50)  ,
    @ClientDealerID  varchar(50)  ,
    @DMSType  varchar(50)  ,
    @StockNumber  varchar(50)  ,
    @InventoryDate  datetime  ,
    @StockType  varchar(100)  ,
    @DMSStatus  varchar(50)  ,
    @InvoicePrice  numeric(18, 2)  ,
    @CostPack  varchar(50)  ,
    @SalesCost  numeric(18, 2)  ,
    @HoldbackAmount  numeric(18, 2)  ,
    @ListPrice  numeric(18, 2)  ,
    @MSRP  varchar(max)  ,
    @LotLocation  varchar(50)  ,
    @TagLine  varchar(max)  ,
    @Certification  varchar(max)  ,
    @CertificationNumber  varchar(max)  ,
    @VehicleVIN  varchar(50)  ,
    @VehicleYear  bigint  ,
    @VehicleMake  varchar(50)  ,
    @VehicleModel  varchar(50)  ,
    @VehicleModelCode  varchar(50)  ,
    @VehicleTrim  varchar(50)  ,
    @VehicleSubTrimLevel  varchar(max)  ,
    @Classification  varchar(max)  ,
    @TypeCode  varchar(100)  ,
    @VehicleMileage  bigint  ,
    @EngineCylinderCount  bigint  ,
    @TransmissionType  varchar(50)  ,
    @VehicleExteriorColor  varchar(50)  ,
    @VehicleInteriorColor  varchar(50)  ,
    @CreatedDate  datetime  ,
    @LastModifiedDate  datetime  ,
    @ModifiedFlag  varchar(max)  ,
    @InteriorColorCode  varchar(50)  ,
    @ExteriorColorCode  varchar(50)  ,
    @PackageCode  varchar(50)  ,
    @CodedCost  varchar(50)  ,
    @Air  varchar(100)  ,
    @OrderType  varchar(max)  ,
    @AgeDays  bigint  ,
    @OutstandingRO  varchar(50)  ,
    @DlrAccessoryRetail  varchar(50)  ,
    @DlrAccessoryCost  varchar(max)  ,
    @DlrAccessoryDesc  varchar(max)  ,
    @ModelDesc  varchar(50)  ,
    @Memo1  varchar(1000)  ,
    @Memo2  varchar(max)  ,
    @Weight  varchar(max)  ,
    @FloorPlan  numeric(18, 2)  ,
    @Purchaser  varchar(max)  ,
    @PurchasedFrom  varchar(max)  ,
    @InternetPrice  varchar(50)  ,
    @InventoryAcctDollar  numeric(18, 2)  ,
    @VehicleType  varchar(50)  ,
    @DealerAccessoryCode  varchar(50)  ,
    @AllInventoryAcctDollar  numeric(18, 2)  ,
    @BestPrice  varchar(50)  ,
    @InStock  bigint  ,
    @AccountingMake  varchar(50)  ,
    @GasDiesel  varchar(max)  ,
    @BookValue  varchar(10)  ,
    @FactoryAccessoryDescription  varchar(max)  ,
    @TotalReturn  varchar(10)  ,
    @TotalCost  varchar(10)  ,
    @SS  varchar(max)  ,
    @VehicleBody  varchar(max)  ,
    @StandardEquipment  varchar(max)  ,
    @Account  varchar(max)  ,
    @CalculatedPrice  varchar(10)  ,
    @OriginalCost  varchar(10)  ,
    @AccessoryCore  varchar(10)  ,
    @OtherDollar  varchar(10)  ,
    @PrimaryBookValue  varchar(10)  ,
    @AmountDue  varchar(10)  ,
    @LicenseFee  varchar(10)  ,
    @ICompany  varchar(max)  ,
    @InvenAcct  varchar(max)  ,
    @Field23  varchar(max)  ,
    @Field24  varchar(max)  ,
    @SalesCode  varchar(max)  ,
    @BaseRetail  varchar(10)  ,
    @BaseInvAmt  varchar(10)  ,
    @CommPrice  varchar(10)  ,
    @Price1  varchar(10)  ,
    @Price2  varchar(10)  ,
    @StickerPrice  varchar(10)  ,
    @TotInvAmt  varchar(10)  ,
    @OptRetail  varchar(max)  ,
    @OptInvAmt  varchar(10)  ,
    @OptCost  varchar(10)  ,
    @Options  varchar(max)  ,
    @Category  varchar(max)  ,
    @Description  varchar(max)  ,
    @Engine  varchar(max)  ,
    @ModelType  varchar(max)  ,
    @FTCode  varchar(max)  ,
    @Wholesale  varchar(max)  ,
    @Retail  varchar(max)  ,
    @Draft  varchar(max)  ,
    @Inventoryid int;
    DECLARE Inventory_Cursor CURSOR FOR 
    SELECT * from [dbo].[FLATFILE_INVENTORY];
    OPEN Inventory_Cursor
    FETCH NEXT FROM Inventory_Cursor 
    INTO @FileType   ,
    @ACDealerID     ,
    @ClientDealerID     ,
    @DMSType     ,
    @StockNumber     ,
    @InventoryDate    ,
    @StockType    ,
    @DMSStatus     ,
    @InvoicePrice     ,
    @CostPack     ,
    @SalesCost     ,
    @HoldbackAmount     ,
    @ListPrice     ,
    @MSRP     ,
    @LotLocation     ,
    @TagLine     ,
    @Certification     ,
    @CertificationNumber     ,
    @VehicleVIN     ,
    @VehicleYear     ,
    @VehicleMake     ,
    @VehicleModel     ,
    @VehicleModelCode     ,
    @VehicleTrim     ,
    @VehicleSubTrimLevel     ,
    @Classification     ,
    @TypeCode    ,
    @VehicleMileage     ,
    @EngineCylinderCount     ,
    @TransmissionType     ,
    @VehicleExteriorColor     ,
    @VehicleInteriorColor     ,
    @CreatedDate    ,
    @LastModifiedDate    ,
    @ModifiedFlag     ,
    @InteriorColorCode     ,
    @ExteriorColorCode     ,
    @PackageCode     ,
    @CodedCost     ,
    @Air    ,
    @OrderType     ,
    @AgeDays     ,
    @OutstandingRO     ,
    @DlrAccessoryRetail     ,
    @DlrAccessoryCost     ,
    @DlrAccessoryDesc     ,
    @ModelDesc     ,
    @Memo1 ,
    @Memo2     ,
    @Weight     ,
    @FloorPlan     ,
    @Purchaser     ,
    @PurchasedFrom     ,
    @InternetPrice     ,
    @InventoryAcctDollar     ,
    @VehicleType     ,
    @DealerAccessoryCode     ,
    @AllInventoryAcctDollar     ,
    @BestPrice     ,
    @InStock     ,
    @AccountingMake     ,
    @GasDiesel     ,
    @BookValue     ,
    @FactoryAccessoryDescription     ,
    @TotalReturn     ,
    @TotalCost     ,
    @SS     ,
    @VehicleBody     ,
    @StandardEquipment     ,
    @Account     ,
    @CalculatedPrice     ,
    @OriginalCost     ,
    @AccessoryCore     ,
    @OtherDollar     ,
    @PrimaryBookValue     ,
    @AmountDue     ,
    @LicenseFee     ,
    @ICompany     ,
    @InvenAcct     ,
    @Field23     ,
    @Field24     ,
    @SalesCode     ,
    @BaseRetail     ,
    @BaseInvAmt     ,
    @CommPrice     ,
    @Price1     ,
    @Price2     ,
    @StickerPrice     ,
    @TotInvAmt     ,
    @OptRetail     ,
    @OptInvAmt     ,
    @OptCost     ,
    @Options     ,
    @Category     ,
    @Description     ,
    @Engine     ,
    @ModelType     ,
    @FTCode     ,
    @Wholesale     ,
    @Retail     ,
    @Draft     ;
    WHILE @@FETCH_STATUS = 0
    BEGIN
        PRINT @VehicleVIN    ;
    -- ****************** insert into Inventory Table ***********
    INSERT INTO INVENTORY 
    IconicDealerID,
    StockNumber,
    DMSType,
    InventoryDate
    VALUES (@ClientDealerID,@StockNumber,@DMSType,@InventoryDate);
    set @Inventoryid = scope_identity();
    PRINT @Inventoryid;
    --Insert into Inventory_Details Table
    INSERT INTO [INVENTORY_DETAILS]
    InventoryID,
    StockType,
    DMSStatus,
    LotLocation,
    TagLine,
    Certification,
    CertificationNumber,
    CreatedDate,
    LastModifiedDate,
    ModifiedFlag,
    PackageCode,
    OrderType,
    AgeDays,
    OutstandingRO,
    Memo1,
    Memo2,
    Purchaser,
    PurchasedFrom,
    DealerAccessoryCode,
    InStock,
    AccountingMake,
    SS,
    Account,
    AccessoryCore,
    ICompany,
    InvenAcct,
    Field23,
    Field24,
    SalesCode,
    Draft,
    FTCode
    VALUES (
    @InventoryID,
    @StockType,
    @DMSStatus,
    @LotLocation,
    @TagLine,
    @Certification,
    @CertificationNumber,
    @CreatedDate,
    @LastModifiedDate,
    @ModifiedFlag,
    @PackageCode,
    @OrderType,
    @AgeDays,
    @OutstandingRO,
    @Memo1,
    @Memo2,
    @Purchaser,
    @PurchasedFrom,
    @DealerAccessoryCode,
    @InStock,
    @AccountingMake,
    @SS,
    @Account,
    @AccessoryCore,
    @ICompany,
    @InvenAcct,
    @Field23,
    @Field24,
    @SalesCode,
    @Draft,
    @FTCode
    --Insert into Inventory_Amount Table
    INSERT INTO [dbo].[INVENTORY_AMOUNT]
    InventoryID,
    AllInventoryAcctDollar,
    OtherDollar,
    PrimaryBookValue,
    AmountDue,
    LicenseFee,
    CalculatedPrice,
    OriginalCost,
    BookValue,
    TotalReturn,
    TotalCost,
    DlrAccessoryRetail,
    DlrAccessoryCost,
    DlrAccessoryDesc,
    InternetPrice,
    InventoryAcctDollar,
    BestPrice,
    Weight,
    FloorPlan,
    CodedCost,
    InvoicePrice,
    CostPack,
    SalesCost,
    HoldbackAmount,
    ListPrice,
    MSRP,
    BaseRetail,
    BaseInvAmt,
    CommPrice,
    Price1,
    Price2,
    StickerPrice,
    TotInvAmt,
    OptRetail,
    OptInvAmt,
    OptCost,
    Wholesale,
    Retail
    VALUES (
    @InventoryID,
    @AllInventoryAcctDollar,
    @OtherDollar,
    @PrimaryBookValue,
    @AmountDue,
    @LicenseFee,
    @CalculatedPrice,
    @OriginalCost,
    @BookValue,
    @TotalReturn,
    @TotalCost,
    @DlrAccessoryRetail,
    @DlrAccessoryCost,
    @DlrAccessoryDesc,
    @InternetPrice,
    @InventoryAcctDollar,
    @BestPrice,
    @Weight,
    @FloorPlan,
    @CodedCost,
    @InvoicePrice,
    @CostPack,
    @SalesCost,
    @HoldbackAmount,
    @ListPrice,
    @MSRP,
    @BaseRetail,
    @BaseInvAmt,
    @CommPrice,
    @Price1,
    @Price2,
    @StickerPrice,
    @TotInvAmt,
    @OptRetail,
    @OptInvAmt,
    @OptCost,
    @Wholesale,
    @Retail
    --Insert into Inventory_Vehicle Table
    INSERT INTO [dbo].[INVENTORY_VEHICLE]
    InventoryID,
    InteriorColorCode,
    ExteriorColorCode,
    Air,
    ModelDesc,
    VehicleType,
    VehicleVIN,
    VehicleYear,
    VehicleMake,
    VehicleModel,
    VehicleModelCode,
    VehicleTrim,
    VehicleSubTrimLevel,
    Classification,
    TypeCode,
    VehicleMileage
    VALUES (
    @InventoryID,
    @InteriorColorCode,
    @ExteriorColorCode,
    @Air,
    @ModelDesc,
    @VehicleType,
    @VehicleVIN,
    @VehicleYear,
    @VehicleMake,
    @VehicleModel,
    @VehicleModelCode,
    @VehicleTrim,
    @VehicleSubTrimLevel,
    @Classification,
    @TypeCode,
    @VehicleMileage
    -- Move cursor to Next record 
        FETCH NEXT FROM Inventory_Cursor 
    INTO @FileType   ,
    @ACDealerID     ,
    @ClientDealerID     ,
    @DMSType     ,
    @StockNumber     ,
    @InventoryDate    ,
    @StockType    ,
    @DMSStatus     ,
    @InvoicePrice     ,
    @CostPack     ,
    @SalesCost     ,
    @HoldbackAmount     ,
    @ListPrice     ,
    @MSRP     ,
    @LotLocation     ,
    @TagLine     ,
    @Certification     ,
    @CertificationNumber     ,
    @VehicleVIN     ,
    @VehicleYear     ,
    @VehicleMake     ,
    @VehicleModel     ,
    @VehicleModelCode     ,
    @VehicleTrim     ,
    @VehicleSubTrimLevel     ,
    @Classification     ,
    @TypeCode    ,
    @VehicleMileage     ,
    @EngineCylinderCount     ,
    @TransmissionType     ,
    @VehicleExteriorColor     ,
    @VehicleInteriorColor     ,
    @CreatedDate    ,
    @LastModifiedDate    ,
    @ModifiedFlag     ,
    @InteriorColorCode     ,
    @ExteriorColorCode     ,
    @PackageCode     ,
    @CodedCost     ,
    @Air    ,
    @OrderType     ,
    @AgeDays     ,
    @OutstandingRO     ,
    @DlrAccessoryRetail     ,
    @DlrAccessoryCost     ,
    @DlrAccessoryDesc     ,
    @ModelDesc     ,
    @Memo1 ,
    @Memo2     ,
    @Weight     ,
    @FloorPlan     ,
    @Purchaser     ,
    @PurchasedFrom     ,
    @InternetPrice     ,
    @InventoryAcctDollar     ,
    @VehicleType     ,
    @DealerAccessoryCode     ,
    @AllInventoryAcctDollar     ,
    @BestPrice     ,
    @InStock     ,
    @AccountingMake     ,
    @GasDiesel     ,
    @BookValue     ,
    @FactoryAccessoryDescription     ,
    @TotalReturn     ,
    @TotalCost     ,
    @SS     ,
    @VehicleBody     ,
    @StandardEquipment     ,
    @Account     ,
    @CalculatedPrice     ,
    @OriginalCost     ,
    @AccessoryCore     ,
    @OtherDollar     ,
    @PrimaryBookValue     ,
    @AmountDue     ,
    @LicenseFee     ,
    @ICompany     ,
    @InvenAcct     ,
    @Field23     ,
    @Field24     ,
    @SalesCode     ,
    @BaseRetail     ,
    @BaseInvAmt     ,
    @CommPrice     ,
    @Price1     ,
    @Price2     ,
    @StickerPrice     ,
    @TotInvAmt     ,
    @OptRetail     ,
    @OptInvAmt     ,
    @OptCost     ,
    @Options     ,
    @Category     ,
    @Description     ,
    @Engine     ,
    @ModelType     ,
    @FTCode     ,
    @Wholesale     ,
    @Retail     ,
    @Draft     ;
    END 
    CLOSE Inventory_Cursor;
    DEALLOCATE Inventory_Cursor;
    GO
    SET ANSI_PADDING OFF
    GO
    Arunraj Kumar

  • Multi table insert

    Hello boys,
    I would like to do an insert into 3 tables:
    insert into t1
    if found insert into t2
    if not found insert into t3.
    So 2 out of 3 tables will end up with data.
    I would like to do it in 1 multi table insert.
    I can't use selects from the destination tables cause they are in the terabytes. I tried a number of combinations of primary keys error logging tables ("log errors reject limit unlimited") but without any success.
    Any ideas?

    Hello Exor,
    You said,
    insert into t1
    if found insert into t2
    if not found insert into t3.
    What is found condition? What are you checking and have you looked into insert all clause if that what you needed. Remember you can have complex join in your select and insert into 3 or 4 table based your "found" condition. This might be fastest way to move data into 3 tables instead of using cursor or bulk collect.
      INSERT ALL
       WHEN order_total < 1000000 THEN
          INTO small_orders
       WHEN order_total > 1000000 AND order_total < 2000000 THEN
          INTO medium_orders
       WHEN order_total > 2000000 THEN
          INTO large_orders
       SELECT order_id, order_total, sales_rep_id, customer_id
          FROM orders;Regards

  • Multi table insert and ....tricky problem

    I have three account related table
    --staging table where all raw records exist
    acc_event_stage
    (acc_id NUMBER(22) NOT NULL,
    event_code varchar2(50) NOT NULL,
    event_date date not null);
    --production table where valid record are moved from staging table
    acc_event
    (acc_id NUMBER(22) NOT NULL,
    event_code varchar2(50) NOT NULL,
    event_date date not null);
    --error records from staging are moved in here
    err_file
    (acc_id NUMBER(22) NOT NULL,
    error_code varchar2(50) NOT NULL);
    --summary records from production account table
    acc_event_summary
    (acc_id NUMBER(22) NOT NULL,
    event_date date NOT NULL,
    instance_flag char(1) not null);
    records in the staging table may look like this(I have put it in simple english for ease)
    open account A on June 12 8 am
    close account A on June 12 9 am
    open account A on June 12 11 am
    Rules
    Account cannot be closed if an open account doesnt exist
    account cannot be updated if an open account doesnt exist
    account cannot be opened if an open account already exist.
    Since I am using
    Insert all
    when open account record and account already exist
    into ...error table
    when close account record and open account doesnt exist
    into ...error table
    else
    into account_event table.
    select * from acc_event_stage order by ..
    wondering if the staging table has records like this
    open account A on June 12 8 am
    close account A on June 12 9 am
    open account A on June 12 11 am
    then how can I validate some of the records given the rule above.I can do the validation from existing records (before the staging table data arrived) without any problem.But the tricky part is the new records in the staging table.
    This can be easily achieved if I do cursor loop method,but doing a multi table insert looks like a problem
    any opinion.?
    thx
    m

    In short,in simple example,
    through multi table insert if I insert record in production account event table from
    staging account event table,making sure that the record doesnt exist in the production table.This will bomb if 2 open account exist in the current staging table.
    It will also bomb if an open account and then close account exist.
    etc.

  • VLD-1119: Unable to generate Multi-table Insert statement for some or all t

    Hi All -
    I have a map in OWB 10.2.0.4 which is ending with following error: -
    VLD-1119: Unable to generate Multi-table Insert statement for some or all targets.*
    Multi-table insert statement cannot be generated for some or all of the targets due to upstream graphs of those targets are not identical on "active operators" such as "join".*
    The map is created with following logic in mind. Let me know if you need more info. Any directions are highly appreciated and many thanks for your inputs in advance: -
    I have two source tables say T1 and T2. There are full outer joined in a joiner and output of this joined is passed to an expression to evaluate values of columns based on
    business logic i.e. If T1 is available than take T1.C1 else take T2.C1 so on.
    A flag is also evaluated in the expression because these intermediate results needs to be joined to third source table say T3 with different condition.
    Based on value taken a flag is being set in the expression which is used in a splitter to get results in three intermediate tables based on flag value evaluated earlier.
    These three intermediate tables are all truncate insert and these are unioned to fill a final target table.
    Visually it is something like this: -
    T1 -- T3 -- JOINER1
    | -->Join1 (FULL OUTER) --> Expression -->SPLITTER -- JOINER2 UNION --> Target Table
    | JOINER3
    T2 --
    Please suggest.

    I verified that their is a limitation with the splitter operator which will not let you generate a multi split having more than 999 columns in all.
    I had to use two separate splitters to achieve what I was trying to do.
    So the situation is now: -
    Siource -> Split -> Split 1 -> Insert into table -> Union1---------Final tableA
    Siource -> Split -> Split 2 -> Insert into table -> Union1

  • Multi-table INSERT with PARALLEL hint on 2 node RAC

    Multi-table INSERT statement with parallelism set to 5, works fine and spawns multiple parallel
    servers to execute. Its just that it sticks on to only one instance of a 2 node RAC. The code I
    used is what is given below.
    create table t1 ( x int );
    create table t2 ( x int );
    insert /*+ APPEND parallel(t1,5) parallel (t2,5) */
    when (dummy='X') then into t1(x) values (y)
    when (dummy='Y') then into t2(x) values (y)
    select dummy, 1 y from dual;
    I can see multiple sessions using the below query, but on only one instance only. This happens not
    only for the above statement but also for a statement where real time table(as in table with more
    than 20 million records) are used.
    select p.server_name,ps.sid,ps.qcsid,ps.inst_id,ps.qcinst_id,degree,req_degree,
    sql.sql_text
    from Gv$px_process p, Gv$sql sql, Gv$session s , gv$px_session ps
    WHERE p.sid = s.sid
    and p.serial# = s.serial#
    and p.sid = ps.sid
    and p.serial# = ps.serial#
    and s.sql_address = sql.address
    and s.sql_hash_value = sql.hash_value
    and qcsid=945
    Won't parallel servers be spawned across instances for multi-table insert with parallelism on RAC?
    Thanks,
    Mahesh

    Please take a look at these 2 articles below
    http://christianbilien.wordpress.com/2007/09/12/strategies-for-rac-inter-instance-parallelized-queries-part-12/
    http://christianbilien.wordpress.com/2007/09/14/strategies-for-parallelized-queries-across-rac-instances-part-22/
    thanks
    http://swervedba.wordpress.com

  • How can I make that the cursor of a table ...

    Hello,
    how can I make that the cursor of a table (on the frontpanel) go to the starting position? I have placed a table that give back the number of the row if I doubleclick a row on the frontpanel, but when I restart the vi the cursor of the table is on this position. If I have many informations in the table and after restarting there are just one or two, I can`t see this information without scrolling to the top of the table. I want that the cursor (that I see) is at the first row. How can I make it?
    thankyou
    Schwede

    Hello,
    Sorry, I forgot to attach it in the previous post.
    Regards,
    Paulo
    Attachments:
    EditPos.vi ‏16 KB

  • Create tables insert something inside and then connect my application to db

    thank you to be patient with me. ok since the beginning I think I have learned a lot with the people responses. so my database is mounted now. I used the cmd.exe command line. i have create an instance, a service, and the database. Now, I need to do two things:create tables inside of my database and insert something inside but I only have the sql script (I will add it at the end of the thread).it is just a part of my huge script.. but this cript can not be open with the command line. So I want to know if you could help me change some stuff inside in the aim to run this script with the command line.that's the first point
    secondly, I have an application named lifetrack. i want to connect this application with my database. so how can I change my settings file to be able to do that?(I will add the settings file I have at the end.It is the one I use for sql server). thanks a lot.I'm a french student so I try my best to answer you in a good english. and believe me if I have the exact way to create table,insert something inside like indicate in the part of my script and connect an application to the database you will never see my thread again. thank you
    1) sql script to create tables
    CREATE TABLE [admin_table] (
         [Can_highlight] [float] NULL ,
         [User_name] [nvarchar] (30) COLLATE Latin1_General_CI_AS NULL ,
         [User_passwd] [nvarchar] (10) COLLATE Latin1_General_CI_AS NULL ,
         [User_group] [nvarchar] (30) COLLATE Latin1_General_CI_AS NULL ,
         [Can_consolidate] [smallint] NULL ,
         [Can_edit_autorpt] [smallint] NULL ,
         [Can_edit_disturbance] [smallint] NULL
    ) ON [PRIMARY]
    GO
    INSERT INTO [admin_table] ([Can_highlight],[User_name],[User_passwd],[User_group],[Can_consolidate],[Can_edit_autorpt],[Can_edit_disturbance])
         VALUES (1.0,'A Andrews','A','both',0,0,1)
    GO
    2) sql server settings file
    ' NOTES:
    ' ======
    ' The parameters in this file are used to specify the following configuration features for the system
    ' 1. the plant profile
    ' 2. the default database as well as the available searchable databases
    ' 3. the paths for accessing particular files used or generated by the system
    ' The Panels Configuration Mode has either of two values: "Embedded" or "External". It is a setting that determines
    ' whether the system loads configuration data for the sections of subjects buttons, which are already embedded
    ' within it, or whether it loads them from the external file:
    ' "Lifetrack Subjects Panel Configuration.dat"
    ' The System Database is an index value (zero-based) that determines which of the listed available databases
    ' is the main active one. In the DATABASES section, the parameters in each comma separated string
    ' designate the following (in this order):
    ' DB Index, DB Name, DB Type, DB Filepath, Server Name, Username, Password
    PLANT SUBJECTS PANEL:
    Panels Configuration Mode: Embedded
    DATABASES:
    System Database: 0
    Available Databases: 1
    0,abc_plant,SQL-Server,SQLSERVER_DATABASE,(local),sa,password
    FOLDERS:
    Saved_Log_Folder: .\
    Saved_NOB_Folder: .\
    Saved_Log&NOB_Together_Folder: .\
    MICROSOFT OFFICE PATHNAME:
    Pathname: C:\Program Files\Microsoft Office\Office11\

    Yet another thread and yet another cut & paste job.

  • Can we create cursor using the table created dynamically

    Dear all,
    Can we create the cursor using the table which is created dynamically using "Execute immediate" within the same procedure,
    or is there any way to call the table created dynamically ..
    please Do Help me in this
    thanks alot
    Edited by: khaja on Jan 18, 2009 10:57 AM

    Well, I don't think this approach is bad in any possible circumstances. It depends on the requirements we don't know. Yes, usually applications should not be designed in this way. But 'usually' does not mean 'never'. One possible case is described in Oracle's example Referencing Database Objects that Do Not Exist at Compilation. It's possible to assume that tables inv_01_2003, inv_04_2003, etc from the referenced topic What Is Dynamic SQL? are generated automatically by some job using dynamic create table stmt. If the OP has similar requirements tnen this approach is not bad. It may not be the best one but it at least is not so bad as you said.
    I believe that OPs know their requirements much better than me. This is why I always try to answer the exact question. If the approach is really ugly then I don't answer such questions at all.
    Regards,
    Dima
    Message was edited by:
    DimaCit

  • Can the cell lines be removed from a table inserted in a Pages document?

    Can the cell lines be removed from a table inserted in a Pages document?

    Inspector > Table > Table > Cell Borders
    The buttons immediately below "Cell Borders" allow you to choose left, right, inside, outside etc.
    Choose None from the border style Pop-up.
    Download the Number'09UserGuide from the Help menu in Pages. Search for borders.
    Regards,
    Ian.

  • How to validate the field when i am populating the data cursor to block

    Hi,
    I am populating data cursor to multi record block.
    Block contain 5 items. I am populating data cursor to block for 4 items. User will enter one item value that is quantity field.
    If user enter negative values and decimal points in quantity filed i need to display message to user item level.
    Please do the needful how to do it.

    902434 wrote:
    Hi,
    I am populating data cursor to multi record block.
    Block contain 5 items. I am populating data cursor to block for 4 items. User will enter one item value that is quantity field.
    If user enter negative values and decimal points in quantity filed i need to display message to user item level.
    Please do the needful how to do it.If you want to validate at entry level then use When-Validate-Item trigger and check the input and show message. Like
    If :quentity <0 then
    message('do not enter negative value');
    message('do not enter negative value');
    raise form_trigger_failure;
    end if;Why u open same thread again ? not closing one.. check this one
    </a>
    How to validate the field when i am populating the data cursor to block
    Hopes this helps
    If someone's response is helpful or correct, please mark it accordingly.

Maybe you are looking for