ORA-30926 on MERGE statement, occurs only with PARALLEL, success without PARALLEL hint hint.

Hi Experts,

I write under the MERGE statement. In this cardinality of the table_a table_b is 1:2. That is, each record of table_b corresponds to 2 records in table_a based on columns in CLAUSE.

Well, this query throws below error.

-Error-

ORA-12801: error reported in the P011 parallel query server

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

However, the same statement runs successfully what tip PARALLEL is removed altogether. (There are no duplicates in table_b based on unity, group, loc columns.)

Please sugget if anything look his place here or causes possible.

-Request-

MERGE / * + PARALLEL (8) * /.

IN table_a a

With the HELP of table_b b

ON (a.unit = b.unit

AND a.group = b.group

AND a.loc = b.loc)

WHEN MATCHED

THEN UPDATE

SET a.u_pushonly = b.u_pushonly

a.u_seasonind = b.u_seasonind,

a.eff = BOX

WHEN b.u_season_start_dt <>TO_DATE('01/01/1970','DD/MM/YYYY')

OR b.u_season_end_dt <>TO_DATE('01/01/1970','DD/MM/YYYY')

OR b.u_pushonly = 1

THEN more GRAND (NVL (b.u_assortment_start_dt, TO_DATE('01/01/1970','DD/MM/YYYY'))

b.u_season_start_dt)

Of OTHER NVL (b.u_assortment_start_dt, TO_DATE('01/01/1970','DD/MM/YYYY'))

END;

kendenny wrote:

Fusion requires that columns be unique in both tables. Given that you only update was not insert is not put in correspondence, then you can use a single update statement.

I don't think so, it requires only NEW data is unique. Informal argument: a single line in the new table can update several lines in the table of old, but you can not use several lines in the new table to update a single row in the old table.

However, I wonder if something went wrong with the parallelism so that the lines with the same VALUES for the data (old) table_a has been distributed through many slaves, leading to several slaves, trying to update each on the other lines.  (I don't see how this could happen, but it's one of the problems with bugs - if she should not deceive you, it can be difficult to imagine how it's bad).

To the OP - this sounds like something, you need to trigger an SR for (after a search of MOS).

Concerning

Jonathan Lewis

Tags: Database

Similar Questions

  • Merge statement: update only when a difference

    Hello

    I have two tables have almost the same columns, how can I use the merge statement to update the table target only when there is difference between the source and target table. Is there an easier way to do not compare every column one by one? I use Oracle 11.2.


    Here's the MERGE statement:

    Merge into trgt tb_trgt using tb_src src
    on (src.id = trgt.id)
    When not matched then values of insertion (trgt.id, trgt.nm, trgt.addr) (src.id, src.nm, src.nm)
    when matched, then update set trgt.nm = src.nm, trgt.addr = src.addr
    where trgt.nm <>src.nm or trgt.addr <>src.addr
    ;

    Is there an easier way to clarify the clause in the NO MATCHED? I don't want to compare every column in the tables. Because I might have a lot of columns in tables.

    Thank you

    939569 wrote:
    I have two tables have almost the same columns, how can I use the merge statement to update the table target only when there is difference between the source and target table. Is there an easier way to do not compare every column one by one? I use Oracle 11.2.
    Is there an easier way to clarify the clause in the NO MATCHED? I don't want to compare every column in the tables. Because I might have a lot of columns in tables.

    I use the method of Tom Kyte to compare tables; It gives me the differences between the source and the target using GROUP BY, who manages the value NULL comparisons. Can I use this result in the MERGER. Here is a step by step illustration. First, set up test data:

    define num_rows = 10
    /
    define pct = 20
    /
    define value_length = 50
    /
    define num_mods = round((&num_rows/3)*(&pct/100),0)
    /
    DROP TABLE T_TARGET;
    /
    DROP TABLE T_SOURCE;
    /
    create table t_target(key1 number, value1 varchar2(&value_length), constraint pk_target primary key(key1));
    insert /*+ append */ into t_target
    select level+&num_mods*3, rpad('DO NOTHING - same in source and target ',&value_length, '*')
    from dual
    where level <= &num_rows-&num_mods*2 connect by level <= &num_rows-&num_mods*2;
    /
    create table t_source as select * from t_target;
    /
    insert into t_source
    select level, rpad('INSERT - in source, not in target ',&value_length, '*')
    from dual where level <= &num_mods connect by level <= &num_mods;
    /
    insert into t_target
    select level+&num_mods, rpad('DELETE (after update) - not in source, in target ',&value_length, '*')
    from dual where level <= &num_mods connect by level <= &num_mods;
    /
    insert into t_source
    select level+&num_mods*2, rpad('UPDATE - put this in target ',&value_length, '*')
    from dual where level <= &num_mods connect by level <= &num_mods;
    /
    insert into t_target
    select level+&num_mods*2, rpad('UPDATE - update this from source ',&value_length, '*')
    from dual where level <= &num_mods connect by level <= &num_mods;
    /
    commit;
    /
    select 't_target', count(*), value1 from t_target group by 't_target', value1
    union all
    select 't_source', count(*), value1 from t_source group by 't_source', value1;
    /
    'T_TARGET'   COUNT(*) VALUE1
    ---------- ---------- --------------------------------------------------
    t_target            1 UPDATE - update this from source *****************
    t_target            8 DO NOTHING - same in source and target ***********
    t_target            1 DELETE (after update) - not in source, in target *
    t_source            1 UPDATE - put this in target **********************
    t_source            8 DO NOTHING - same in source and target ***********
    t_source            1 INSERT - in source, not in target ****************
    

    So, I need to do an insert, update, and a delete.

    Now I'll build code comparison step by step. I don't show the results every time, but if you run each query yourself can see what is happening.

    -- Step by step build of "refresh by merge" USING ROWIDs
    -- Result: with cardinality hint, can use "BY USER ROWID" and avoid 3d full scan
    -- 1) Full scan of both tables to get data,
    -- identify old / new records and get old ROWID
    select KEY1,VALUE1,
    1 old_cnt, 0 new_cnt, rowid rid from T_TARGET o
    UNION ALL
    SELECT KEY1,VALUE1,
    0 old_cnt, 1 new_cnt, NULL FROM T_SOURCE n
    /
    -- 2) GROUP BY compares records, identical records have old_cnt = new_cnt
    select KEY1,VALUE1,
    sum(old_cnt) old_cnt, sum(new_cnt) new_cnt, max(rid) rid
    FROM (
      select KEY1,VALUE1,
      1 old_cnt, 0 new_cnt, rowid rid from T_TARGET o
      UNION ALL
      SELECT KEY1,VALUE1,
      0 old_cnt, 1 new_cnt, NULL FROM T_SOURCE n
    )
    group by KEY1,VALUE1
    /
    -- 3) Filter out identical records
    select KEY1,VALUE1,
    sum(old_cnt) old_cnt, sum(new_cnt) new_cnt, max(rid) rid
    FROM (
      select KEY1,VALUE1,
      1 old_cnt, 0 new_cnt, rowid rid from T_TARGET o
      UNION ALL
      SELECT KEY1,VALUE1,
      0 old_cnt, 1 new_cnt, NULL FROM T_SOURCE n
    )
    group by KEY1,VALUE1
    having sum(old_cnt) <> sum(new_cnt)
    /
    -- 4) for INSERT, keep NEW; for DELETE, keep OLD;
    -- for UPDATE, keep NEW values and OLD rid
    SELECT /*+ cardinality(1) */ KEY1,VALUE1,
    old_cnt, new_cnt, row_number() OVER(PARTITION BY KEY1 ORDER BY old_cnt) rn
    , max(rid) over(partition by key1) rid
    from (
      select KEY1,VALUE1,
      sum(old_cnt) old_cnt, sum(new_cnt) new_cnt, max(rid) rid
      FROM (
        select KEY1,VALUE1,
        1 old_cnt, 0 new_cnt, rowid rid from T_TARGET o
        UNION ALL
        SELECT KEY1,VALUE1,
        0 old_cnt, 1 new_cnt, NULL FROM T_SOURCE n
      )
      group by KEY1,VALUE1
      having sum(old_cnt) <> sum(new_cnt)
    )
    /
    -- 5) Filter out OLD UPDATE record, not needed
    SELECT KEY1,VALUE1,
    new_cnt, rid
    FROM (
      SELECT /*+ cardinality(1) */ KEY1,VALUE1,
      old_cnt, new_cnt, row_number() OVER(PARTITION BY KEY1 ORDER BY old_cnt) rn
      , max(rid) over(partition by key1) rid
      from (
        select KEY1,VALUE1,
        sum(old_cnt) old_cnt, sum(new_cnt) new_cnt, max(rid) rid
        FROM (
          select KEY1,VALUE1,
          1 old_cnt, 0 new_cnt, rowid rid from T_TARGET o
          UNION ALL
          SELECT KEY1,VALUE1,
          0 old_cnt, 1 new_cnt, NULL FROM T_SOURCE n
        )
        group by KEY1,VALUE1
        having sum(old_cnt) <> sum(new_cnt)
      )
    ) where rn = 1
    /
    
    KEY1     VALUE1                                   NEW_CNT     RID
    1     INSERT - in source, not in target ****************     1
    2     DELETE (after update) - not in source, in target *     0     AAAcDHAAMAAAACtAAA
    3     UPDATE - put this in target **********************     1     AAAcDHAAMAAAACtAAB
    

    Now, here's the real MERGER:

    merge into T_TARGET o
    USING (
      SELECT KEY1,VALUE1,
      new_cnt, rid
      FROM (
        SELECT /*+ cardinality(1) */ KEY1,VALUE1,
        old_cnt, new_cnt, row_number() OVER(PARTITION BY KEY1 ORDER BY old_cnt) rn
        , max(rid) over(partition by key1) rid
        from (
          select KEY1,VALUE1,
          sum(old_cnt) old_cnt, sum(new_cnt) new_cnt, max(rid) rid
          FROM (
            select KEY1,VALUE1,
            1 old_cnt, 0 new_cnt, rowid rid from T_TARGET o
            UNION ALL
            SELECT KEY1,VALUE1,
            0 old_cnt, 1 new_cnt, NULL FROM T_SOURCE n
          )
          group by KEY1,VALUE1
          having sum(old_cnt) <> sum(new_cnt)
        )
      ) where rn = 1
    ) n
    on (o.rowid = n.rid)
    when matched then update set
    VALUE1=n.VALUE1
    DELETE WHERE (n.new_cnt = 0)
    WHEN NOT MATCHED THEN INSERT (
      KEY1,VALUE1
    ) VALUES (
      n.KEY1,n.VALUE1
    )
    /
    

    Published by: stew Ashton on February 7, 2013 20:42

  • Getting ORA-01017: invalid username/password error only with specific tools

    Hello
    I'm still a Junior DBA familiar with Oracle. I have difficulties to access one of my databases with tools of TOAD and SQLDetective. When I try to connect to my database using these tools, I get the error:

    ORA - 01017: name of user and password invalid. connection refused

    Even if the password and user name is correct.

    I can correctly connect through other tools like SQLTools and sqlplus. I searched on this problem and I've seen people with the same problems, but I could not find a solution. The strange thing is, I can use TOAD and SQLDetective to connect to other databases with no problems. It seems to be present a specific database.

    My database is a database 11g on linux machine. I have clients 9i and 10 g installed on my machine. All my applications use the 9i on my machine home tnsnames.

    Any help on this would be greatly appreciated. Thank you.

    RGS,
    Rob

    Published by: rgilligan on April 16, 2010 02:11

    Hello, if it is 11g, look at the sec_case_sensitive_logon parameter. This default is true, which makes the case-sensitive password. Some tools/applications do a HIGHER or LOWER on the password and so what can the reason for the error

    Henner

  • Packet loss occurs only with more than 200 rep only

    Hello community,

    I have a question, I was experienced packets lost in LAN, my question is when I ping the dest with 100 repetitions for example I do not get any package lost but if I ping the destination with 500 rehearsals always get lost packets (1 or 2).

    Note: I can ping the host with 100 representing several times but I never had any lost package.

    Number of ping 10.32.103.194 Core # 100

    ........

    -10.32.103.194 - ping statistics

    transmitted packets 100, 100 packets received, 0.00% packet loss

    round-trip min/avg/max = 0.505/1.266/10.758 ms

    Number of ping 10.32.103.194 Core # 500

    ..........

    -10.32.103.194 - ping statistics

    transmitted packets 500, 499 packets received, 0.20% packet loss

    round-trip min/avg/max = 0.551/1.283/14.304 ms

    This make sense to you?

    Have you ever had this kind of problem?

    -Sorry for my English.

    Hi Omar,.

    Because the ping packets are of low priority and CPU can drop for any reason he can't serve a ping request.

    Outside the ping packet loss problem you have? If you have packet loss, while your guests try to talk to each other, so it is a concern that needs to be examined. Depending on the platform, there are speed limiters that can drop these packets. So I see this as usual unless you have other problems because of this.

    Thank you

    Madhu

  • coe_load_sql_profile doesn't work with parallel hint

    Hello

    I try to use coe_load_sql_profile to force a sql_id to use a trick.

    My index is / * + PARALLEL(A,8) FULL (a) * /.

    Profile of SQL is generated correctly and I can see it in my explanation, but seems that this only complete suspicion has been used.

    It is a limitation of coe_load_sql_profile?

    Thnaks.

    To illustrate what I mean:

    Series:

    explain plan for
    select /*+ full(t1) */ * from t1;
    select * from table(dbms_xplan.display(format => '+OUTLINE'));
    
    PLAN_TABLE_OUTPUT
    ------------------------------
    Plan hash value: 3617692013
    
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |   194K|    38M|   715   (1)| 00:00:09 |
    |   1 |  TABLE ACCESS FULL| T1   |   194K|    38M|   715   (1)| 00:00:09 |
    --------------------------------------------------------------------------
    
    Outline Data
    -------------
    
      /*+
          BEGIN_OUTLINE_DATA
          FULL(@"SEL$1" "T1"@"SEL$1")
          OUTLINE_LEAF(@"SEL$1")
          ALL_ROWS
          OPT_PARAM('query_rewrite_enabled' 'false')
          DB_VERSION('11.2.0.3')
          OPTIMIZER_FEATURES_ENABLE('11.2.0.3')
          IGNORE_OPTIM_EMBEDDED_HINTS
          END_OUTLINE_DATA
      */  
    
    END_OUTLINE_DATA 
    
      */  
    

    Parallel:

    explain plan for
    select /*+ full(t1) parallel(t1,4) */ * from t1;
    select * from table(dbms_xplan.display(format => '+OUTLINE'));
    
    Plan hash value: 3617692013
    
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |   194K|    38M|   715   (1)| 00:00:09 |
    |   1 |  TABLE ACCESS FULL| T1   |   194K|    38M|   715   (1)| 00:00:09 |
    --------------------------------------------------------------------------
    
    Outline Data
    -------------
    
      /*+
          BEGIN_OUTLINE_DATA
          FULL(@"SEL$1" "T1"@"SEL$1")
          OUTLINE_LEAF(@"SEL$1")
          ALL_ROWS
          OPT_PARAM('query_rewrite_enabled' 'false')
          DB_VERSION('11.2.0.3')
          OPTIMIZER_FEATURES_ENABLE('11.2.0.3')
          IGNORE_OPTIM_EMBEDDED_HINTS
          END_OUTLINE_DATA
      */    
    
    END_OUTLINE_DATA                         
    
      */
    

    The issue is not limited to sql Profiler, it's the same with the base lines.

    Patch SQL III / parallel to baselines. OraStory

  • Crack speakers and buzz only with online video. In charge of the music and sound of the DVD fine

    I have a HP 15-r011dx laptop with windows 8.1 when on youtube or videos CNN, the speakers carack and pop. The ads CNN play before the story are very good as a DVD or my music loaded. I relly don't want to reinstall. I've had the computer for 3 weeks and I don't know if she was there from the beginning. I have updated all of HP, including the BIOS and tried another browser and adjusted the volume levels. Windows has made updates.

    Hello

    I have some other ideas, but it becomes more an environmental issue. Something (I couldn't say what) is causing interference with the audio. As this occurs only with online video/music and not anything ran computer laptop or DVD directly, this indicates that it would be something to do with the Internet.

    There might be questions about Internet bad signals via wireless or bad connections to Web sites. You have problems with streaming?

    You can also try to connect to your network with an Ethernet cable, to test. The question is perhaps more wireless streaming. Again, this could indicate some sort of interference.
    You can also test your router with the nearby. If you notice the problem disappears in some places but is apparent or worse in others. Check to see what's around, other devices may cause the buzz.

    Have you noticed problems in streaming video and audio on other capable network devices (iPhone, Desktop, etc.).

    The last possibility, again it goes back to poor/bad Internet could be the router itself. If it is older, then it might 'go. '

    I know nothing of the above are direct troubleshooting suggestions for the laptop, but two doing exactly the same thing is very rare. More often then not it is and indication that "something else" happening. The idea and the tests above could help determine what exactly will.

    I would like to know how it all happens.
    Thank you.

  • error SQL ORA-00900: invalid SQL statement

    Hi all

    I'm new to sql and I'm trying to solve this problem, I have here.

    When I run this query (1) I get this message: ORA-00900: invalid SQL statement

    Query: 1


    WITH t1
    AS (SELECT CID,
    TYPE,
    TO_CHAR)
    TO_DATE (' 00:00:00 ', 'HH24:MI:SS')
    + (lg_end_time - lg_start_time).
    Call_time 'HH24:MI:SS'),
    ROW_NUMBER)
    COURSES (SORTING CID CID NULLS FIRST PARTITION)
    AS call_id1
    OF test_1
    )
    SELECT SUM (call_time)
    FROM t1;
    output:
    I get the error: ORA-01722: invalid number




    table structure:

    Select * form test_1;

    CID TYPE LG_END_TIME LG_START_TIME
    1508643 expedition 2012/12/03 14:05 2012/12/03 14:02
    1508643 treatment 2012/12/03 14:00 03/12/2012 14:00
    1508643 initiation 2012/12/03 14:00 03/12/2012 14:00
    1508662 expedition 2012/12/03 14:18 2012/12/03 14:16
    1508662 initiation 2012/12/03 14:01 03/12/2012 14:01
    1508662 treatment 2012/12/03 14:02 03/12/2012 14:01
    1508643 expedition 2012/12/03 14:02 03/12/2012 14:00
    1508662 expedition 2012/12/03 14:16 2012/12/03 14:02

    Thanks for your help

    I think this example might help.

    SQL> select decode(call_id1,99,null,cid)        cid,
      2         decode(call_id1,99,null,type)       type,
      3         decode(call_id1,99,null,to_char(call_time,'hh24:mi:ss'))  call_time,
      4         decode(call_id1,99,null,substr(call_id1,1,5))   call_id1,
      5         total_time
      6    from (select cid,
      7                 type,
      8                 call_time,
      9                 call_id1,
     10                 total_time
     11            from (select cid,
     12                         type,
     13                         call_time,
     14                         call_id1,
     15                         null total_time
     16                    from (SELECT CID ,
     17                                 TYPE,
     18                                 to_date(TO_CHAR (TO_DATE ('00:00:00', 'HH24:MI:SS') +
     19                                        (lg_end_time - lg_start_time),'HH24:MI:SS'),'HH24:MI:SS') call_time,
     20                                 ROW_NUMBER () OVER (PARTITION BY CID ORDER BY CID NULLS FIRST) AS call_id1
     21                            FROM test_1 ) t1
     22                  union all
     23                  select cid,
     24                         null type,
     25                         null call_time,
     26                         99   call_id1,
     27                         lpad(hours,2,'0')||':'||lpad(minutes,2,'0')||':'||lpad(seconds,2,'0') total_time
     28                    from (select cid,
     29                                 sum(to_number(to_char(call_time,'hh24'))) +
     30                                     trunc((sum(to_number(to_char(call_time,'mi'))) +
     31                                     (trunc(sum(to_number(to_char(call_time,'ss')))/60)))/24) hours,
     32                                 sum(to_number(to_char(call_time,'mi'))) +
     33                                    (trunc(sum(to_number(to_char(call_time,'ss')))/60)) minutes,
     34                                 (sum(to_number(to_char(call_time,'ss'))) -
     35                                     ((trunc(sum(to_number(to_char(call_time,'ss')))/60)) * 60)) seconds
     36                            from (SELECT CID ,
     37                                         TYPE,
     38                                         to_date(TO_CHAR (TO_DATE ('00:00:00', 'HH24:MI:SS') +
     39                                                (lg_end_time - lg_start_time),'HH24:MI:SS'),'HH24:MI:SS') call_time,
     40                                         ROW_NUMBER () OVER (PARTITION BY CID ORDER BY CID NULLS FIRST) AS call_id1
     41                                    FROM test_1 ) t1
     42                          group by cid) )
     43          order by cid, call_id1 );
    
    CID                                      TYPE                 CALL_TIME CALL_ID1 TOTAL_TIME
    ---------------------------------------- -------------------- --------- -------- ----------
    1508643                                  Dispatching          00:02:06  1
    1508643                                  Initiation           00:00:00  2
    1508643                                  Treatment            00:00:39  3
    1508643                                  Dispatching          00:02:50  4
                                                                                     00:05:35
    1508662                                  Treatment            00:01:03  1
    1508662                                  Initiation           00:00:00  2
    1508662                                  Dispatching          00:13:17  3
    1508662                                  Dispatching          00:02:43  4
                                                                                     00:17:03
    
    10 rows selected
    
    SQL> 
    
  • MERGE or PL/SQL statement? (and ORA-30926: failed to get a stable set of rows in the source tables)

    Hi SQL & PL/SQL gurus...

    A bit of advice please...

    IM loading documents in the system... In this context, I have a routine that check the progress of loading (upload_records) against an existing table (supplier_records).  If the details differ so it updates, and if the folder does not exist, it inserts a new record...

    About 90% of the time, recording will be unchanged and the statement will do nothing...

    The challenge I have is that I get the error above fairly regularly, because (I think) there are simultaneous users, loading documents in the system... so, both tables change regularly...  The merge statement is below... but my question is: I would achieve anything by converting the merge statement into a PL/SQL loop that checks if the recordset contains a record that needs to either update or insertion? Would be the first simple quick check that reduction of 90% of the files works better, (with further processing if the folder must insert or update) and this would remove the error above, or the merge statement made the same thing anyway, and I should leave it as what? or is my incorrect merge statement and which contribute to the error?  The merge statement, if it finds a match, updates the record anyway, even if she didn't need to...  (which is not very effective)... However a pl/SQL loop will have to check if the record exists. check if it needs to be changed, change it if she does... Insert if the folder does not exist.

    MERGE statement is:

    MERGE INTO s suppliers

    USING (select distinct (sup_provision_id),

    provider,

    sup_acc_holder,

    sup_bank_acc,

    sup_bank_name,

    payments_upload sup_bank_branch

    where csv_id =: P20_CSV_ID) could

    WE (pu.sup_provision_id = s.supplier_id)

    WHEN MATCHED THEN

    GAME UPDATE

    s.SUPPLIER = pu.supplier,

    s.SUP_ACC_HOLDER = pu.sup_acc_holder,

    s.BANK_ACC_NO = pu.sup_bank_acc,

    s.BANK_NAME = pu.sup_bank_name,

    s.BRANCH_NO = pu.sup_bank_branch

    WHEN NOT MATCHED THEN

    INSERT (s.SUPPLIER_ID,

    s.SUPPLIER,

    s.SUP_ACC_HOLDER,

    s.BANK_ACC_NO,

    s.BANK_NAME,

    s.BRANCH_NO,

    s.CAT)

    VALUES (pu.sup_provision_id,

    able. Beg,

    Pu.sup_acc_holder,

    Pu.sup_bank_acc,

    Pu.sup_bank_name,

    Pu.sup_bank_branch,

    'S' );

    Thank you very much

    Richard

    Hi, Richard,.

    Richard Legge wrote:

    Hello.. Thanks for the reply...... The reason for the 'distinct' to ensure that the query retrieves only one line (based on the extraction of the full line, as you point out)... (so why he would never get more than one?) Well Yes... know that the media are not quite relevant...

    The reasoning is that out or 5000 records. 4000 will have the same provider... so want to retrieve a single record for what it (or other unique visitors who may be similar but have different criteria) and simply update the corresponding record, insert if there is no trace...

    Rgds

    Richard

    SELECT DISTINCT guarantees that no 2 rows will be exactly alike.  In other words, if you compare the 2 rows in the result set, either sup_provision_id supplier of GOLD supp_acc_holder for GOLD OR one of the other columns (or maybe 2 or more columns) will be different.  It does not guarantee that any 1 column will be unique.

    FUSION requires that, when a match is found, it should only be 1 line in the result set generated by the USING clause.  Given that the matching condition is

    WE (pu.sup_provision_id = s.supplier_id)

    This means that pu_sup_provision must be unique.  The ORA_30926 error occurs if it is not unique.  SELECT DISTINCT to ensure that complete lines in pu are unique, but it does not guarantee that any single column will be unique.

    Depending on your data and your needs, you may need to change the USING clause, so that sup_provision_id is unique.  You may need to add more conditions to the WHERE clause, or do a GROUP BY or use an analytic function such as ROW_NUMBER.

    If you need help, post a small example of data (that is, CREATE TABLE and INSERT statements for all the tables involved, as they are before the MERGER) and the exact results you want (that is, indicate which suppliers should contain after the MERGER).

    Check out the Forum FAQ: Re: 2. How can I ask a question on the forums?

  • ORA-30926 - Merge statement

    Hi all

    I am facing a problem of failure to merge because of duplicate statement in the Source table. In a merge statement, what I understand is if the Update statement in which corresponding clause contains WHERE predicates, they are pushed upward to filter the lines of the clause?

    In order to understand, I tried to frame a test case to model how my real scenario is:

    create table tab_src (col1, col2 number number, number of col3, col4 varchar2 (5));
    create table tab_des (col1, col2 number number, number of col3, col4 varchar2 (5));

    insert into tab_src values (1, 1, 1, 'AAA');
    insert into tab_src values (1, 1, 0, "AAB");

    insert into tab_des values (1, 1, -1, null);

    explain plan for
    merge into tab_des d
    a_l'_aide_de)
    Select *.
    of tab_src
    where col3 is not null
    ) s
    on (d.col1 = s.col1
    and d.col2 = s.col2
    )
    When matched then
    update the value of col4 = s.col4
    where d.col3 is not null;

    Select *.
    table (dbms_xplan.display (null, null, 'ALL'));

    Hash value of plan: 3751341164

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

    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |

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

    |   0 | MERGE STATEMENT |         |     1.    60.     7 (15) | 00:00:01 |

    |   1.  MERGE | TAB_DES |       |       |            |          |

    |   2.   VIEW               |         |       |       |            |          |

    |*  3 |    HASH JOIN |         |     1.    98.     7 (15) | 00:00:01 |

    |   4.     TABLE ACCESS FULL | TAB_DES |     1.    55.     3 (0) | 00:00:01 |

    |*  5 |     TABLE ACCESS FULL | TAB_SRC |     2.    86.     3 (0) | 00:00:01 |

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

    Name of the query block / Alias object (identified by the operation identity card):

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

    1 MRG$ 1

    3 SALT$ F5BB74E1

    4 SALT$ F5BB74E1 / D@SEL$1

    5. SALT$ F5BB74E1 / TAB_SRC@SEL$2

    Information of predicates (identified by the operation identity card):

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

    3 - access("D".") COL1 "=" TAB_SRC. " "" COL1 "AND

    "D"." COL2 "=" TAB_SRC. " ("" COL2 ")

    5 - filter ("COL3" IS NOT NULL)

    Projection of the column information (identified by the operation identity card):

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

    1 SYSDEF [4], SYSDEF [32720], SYSDEF [1], SYSDEF [76], SYSDEF [32720]

    2 - « D ». "COL3" [NO.22], "S" "." " COL4 ' [VARCHAR2, 5].

    3. (#keys = 2) "D". "COL1" [NO.22], "TAB_SRC" "." " COL1 '[NUMBER, 22],

    "D"." COL2"[NO.22],"TAB_SRC ". ' COL2 '[NUMBER, 22],

    « D ». ROWID [ROWID, 10], "D". "COL4" [VARCHAR2, 5], "D" "." " COL3 '[NUMBER, 22],

    'TAB_SRC '. "COL4" [VARCHAR2, 5], 'COL3 '[NUMBER, 22] "

    4 - « D ». ROWID [ROWID, 10], "D". ' COL1 '[NUMBER, 22],

    "D"." COL2"[NO.22],"D ". "COL3" [NO.22], "D" "." " COL4 ' [VARCHAR2, 5].

    5. "TAB_SRC". "COL1" [NO.22], "TAB_SRC" "." " COL2 '[NUMBER, 22],

    'COL3' [NO.22], "TAB_SRC". "COL4" [VARCHAR2, 5].

    Note

    -----

    -dynamic sampling used for this statement

    The predicate information section made no reference to the column COL3 to the Destination table. Then it would be correct to conclude that the where predicates in the UPDATE clause will play no role in the identification of lines of data from source table/query?

    I use oracle 10.2.0.5.

    That's right, the where clauses are applied as the update is done, they will not be part of the condition WE which identifies the lines merge.  This is why you must make sure that your condition IT only joined the lines to merge and there are no duplicates.

  • Problem with the MERGE statement

    Hi all

    We'll cover the following:

    create table xx_test1 (invoice_id number, line_group_number number, LINE_TYPE_LOOKUP_CODE          VARCHAR2(25) ,LINE_NUMBER                    NUMBER(15)  );
    

    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,1,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,1,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,2,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,2,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,3,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,3,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,4,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,4,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,5,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,5,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,12,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,12,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,7,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,7,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,8,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,8,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,9,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,9,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,10,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,10,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,11,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,11,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,12,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,12,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,13,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,13,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,14,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,14,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,15,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,15,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,16,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,16,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,17,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,17,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,18,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,18,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,19,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,19,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,20,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,20,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,21,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,21,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,22,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,22,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,23,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,23,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,24,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,24,'TAX',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,25,'ITEM',null);
    Insert into XX_TEST1 (INVOICE_ID,LINE_GROUP_NUMBER,LINE_TYPE_LOOKUP_CODE,LINE_NUMBER) values (131549,25,'TAX',null);
    

    So, if we want to MERGE this table and update the lines with below:

    merge into xx_test1 DST
             USING (SELECT  LINE_GROUP_NUMBER,
                  LINE_TYPE_LOOKUP_CODE,
                  ROW_NUMBER() over(order by LINE_TYPE_LOOKUP_CODE, LINE_GROUP_NUMBER) as LINE_NUM
             from xx_test1
            where INVOICE_ID = 131549
           
                 ) SRC
          ON (DST.LINE_GROUP_NUMBER = SRC.LINE_GROUP_NUMBER AND dst.LINE_TYPE_LOOKUP_CODE = src.LINE_TYPE_LOOKUP_CODE AND dst.invoice_id = 131549 )
          WHEN MATCHED THEN
             update
                set DST.LINE_NUMBER = SRC.LINE_NUM
                ;
    


    I get an error message:

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

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

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

    activity or one not deterministic where clause.

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

    I don't know why I'm getting this. Any ideas?

    Version: 11g

    Kind regards

    Alex

    whenever I have this error I convert my fusion in a select to see what is duplication

    select dst.LINE_GROUP_NUMBER, dst.LINE_TYPE_LOOKUP_CODE, count(*)
    from xx_test1 DST
    join (SELECT  LINE_GROUP_NUMBER,
                  LINE_TYPE_LOOKUP_CODE,
                  ROW_NUMBER() over(order by LINE_TYPE_LOOKUP_CODE, LINE_GROUP_NUMBER) as LINE_NUM
             from xx_test1
            where INVOICE_ID = 131549
         ) SRC
     ON (DST.LINE_GROUP_NUMBER = SRC.LINE_GROUP_NUMBER AND dst.LINE_TYPE_LOOKUP_CODE = src.LINE_TYPE_LOOKUP_CODE AND dst.invoice_id = 131549 )
    group by dst.LINE_GROUP_NUMBER, dst.LINE_TYPE_LOOKUP_CODE
    having count(*) > 1
    

    you have 2 dst. LINE_GROUP_NUMBER, summer time. Combination of LINE_TYPE_LOOKUP_CODE this duplication.

  • ORA 22813 in the merge statement

    Hi the gems... Good afternoon...

    My version of the database is 11.2.0.1.0 Solaris 64-bit OS.

    I am facing a ' ORA-22813: value of the operand exceeds the limits of the system "during the execution of a procedure.
    I used loggers and found that it is getting failed in a MERGE statement.

    This merge statement is used to merge a table with a collection. the code is as below:
    MERGE /*+ INDEX(P BALANCE_HISTORIC_INDEX) */
        INTO BALANCE_HOLD_HISTORIC P
        USING TABLE(GET_BALANCE_HIST(V_MERGE_REC)) M
        ON (P.CUSTOMER_ID = M.CUSTOMER_ID AND P.BOOK_ID = M.BOOK_ID AND P.PRODUCT_ID = M.PRODUCT_ID AND P.SUB_BOOK_ID = M.SUB_BOOK_ID AND)
        WHEN MATCHED THEN
          UPDATE
             <set .....>
        WHEN NOT MATCHED THEN
          INSERT<.....>
    Function GET_BALANCE_HIST (V_MERGE_REC) parameter is an array type.
    Now GET_BALANCE_HIST (V_MERGE_REC) is a function in the pipeline and we used that because the V_MERGE_REC collection can become huge with data.

    This process worked very well since the beginning, but since yesterday, it was constantly throwing 22813 ORA error in this line.

    Help, please... Thanks in advance...

    Gogol wrote:
    The code flow is as below:

    There is a sql query, the output is a set of some several lakes of records. Now we take the result of the sql query in a collection with a limit of 1000 (FETCH cur_sql COLLECT LOOSE v_balance_rec LIMIT 1000). Then we do a lot of processing, the calculation of this collection.

    After the treatment and calculation, we are filling another collection this collection transformed (V_BALANCE_REC) (V_MERGE_REC). Thus, if the loop iterates for 1000 times, then the V_MERGE_REC is filled with records of 1000 * 500 = 500000 processed.

    And then we go to this huge V_MERGE_REC collection as a parameter to this function.

    Don't know what are the Lakes. Please use International English.

    Why can't do you math in a SQL query?

    If it's really too hard to do in SQL (SQL queries can perform a treatment fairly complex), then I would look to Scripture
    results of a table and use it.

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

    whenever I run this code I get this error

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

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

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

    activity or one not deterministic where clause.

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

    Don't know wht goes wrong!


    SQL:

    MERGE IN VENDORS_ACTIVE_DATE s

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

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

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

    )

    then "MATCH".

    When d.COMPANY_CODE is null

    then 'DELETE '.

    When s.COMPANY_CODE is null

    then "INSERT."

    else 'UPDATE '.

    chck end)

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

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

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

    ) d

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

    WHEN MATCHED THEN

    UPDATE SET s.VENDOR = d.VENDOR

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

    DELETE WHERE d.chck = 'DELETE '.

    WHEN NOT MATCHED THEN

    INSERT (SELLER, COMPANY_CODE)

    VALUES (d.VENDOR, d.COMPANY_CODE)

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

    MERGE IN VENDORS_ACTIVE_DATE s

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

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

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

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

    - AND D.ACTIVEDATE = S.ACTIVEDATE

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

    and (d.COMPANY_CODE = s.COMPANY_CODE)

    )

    then "MATCH".

    When d.COMPANY_CODE is null

    then 'DELETE '.

    When s.COMPANY_CODE is null

    then "INSERT."

    else 'UPDATE '.

    chck end)

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

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

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

    ) d

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

    WHEN MATCHED THEN

    S.ACTIVEDATE = UPDATE SET d.ACTIVEDATE

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

    DELETE WHERE d.chck = 'DELETE '.

    WHEN NOT MATCHED THEN

    INSERT (VENDOR, ACTIVEDATE, COMPANY_CODE)

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

  • problem compiling with MERGE statement

    What is the problem with this merge statement?

    When I compile I get the message
    met symbol IN when one of the following expected
    *:= . (@ %; < a SQL > *)

    MERGE INTO PF_REP_TEMP HAS
    WITH THE HELP OF PF_REP_SKS B
    WE (a. pf_userid = "FINP' AND B.pfbatch = 'F99' and B.pfstfno = A.pf_staffno
    and B.pfcc = "7" and B.pftransmy = A.mmyy and B.slno = A.s_no)
    When matched then
    game update
    a.pfwdrlm = b.pfwdrlm,
    a.PFRC = b.PFRC;

    Help, please

    (version of the form is 10g, 11g database version)

    How to perform a merge into forms button pressed trigger command

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

    Hi all

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

    PL/SQL Release 12.1.0.1.0 - Production 0

    CORE 12.1.0.1.0 Production 0

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

    NLSRTL Version 12.1.0.1.0 - Production 0

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

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

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

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

    Insert in src values (1, 'a')

    Insert in src values (1, 'b')

    Insert in src values (2, "c")

    merge into tar

    using the CBC

    on (nums = tnum)

    when matched

    then

    update the value tNom = sname

    When not matched

    then

    Insert the values(snum,sname);

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

    Select * from tar

    TNUM TNOM

    1 b

    1 a

    2 c

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

    I saw the document of the Oracle and he said

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

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

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

    Nondeterministic fusion?

    Someone at - it make a clarification?

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

    Thank you

    Hello

    O - O wrote:

    Thanks knani, Frank.

    One more doubt.

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

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

    insert into tar values (1, 'a')

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

    insert into tar values (2, "c")

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

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

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

    Dear all

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

    My env:

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

    I use the generator to warehouse 11.1.0.7 on Linux

    Thank you

    Hello

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

    Kind regards
    Carsten.

Maybe you are looking for