The new MERGE statement in Oracle 9i

Has anyone used the new Merge statement to process large amounts of data? Currently we use PL/SQL to update/insert into our tables when we are loading large amounts of data (close to one million rows) because we can set commit points and avoid rollback problems. I am wondering if we use Merge instead how this will affect rollback? Are we still going to have to code for this problem?
Thanks in advance!

Thanks for the suggestions. Our problem is that the base table contains 50 million rows and seven indexes, and each month we try to insert/update one million rows. Some of the data in the base table is historical so if we implemented your solution we would lose any records not being updated.
What I am really trying to determine is if the MERGE statement has any redo log ramifications. Will we run in rollback space problems if we implement it instead of running PL/SQL in the following format:
FOR cur_rec in c1 LOOP
UPDATE table a
SET col a = cur_rec.col a, ...
WHERE ...
IF SQL%NOTFOUND THEN
INSERT (col a , col b, col c...)
VALUES (cur_rec.col a, cur_rec.col b...);
END IF;
We commit every 10,000 records (as determined by SQL%ROWCOUNT). This can be time comsuming and Oracle claims that the new MERGE command will avoid costly overhead and reduce data scans. However, I am concerned that we may hit rollback problems if we implement a straight SQL statement such as MERGE. Any thoughts?

Similar Messages

  • Why when I merge clips in Audition CC  does the new merge file have no data?

    Why when I merge clips in Audition CC  does the new merge file have no data?  It happens in large projects and once it starts to happen I cannot get merge clips or bounce tracks to work correctly.

    files 1 of 2 and 2 of 2 are for all these languages:
    Chinese (Simplified)
    Chinese (Traditional)
    Czech
    English
    French (Standard)
    German
    Italian
    Japanese
    Korean
    Polish
    Portuguese (Brazilian)
    Russian
    Spanish
    Swedish
    Turkish

  • [svn:osmf:] 13028: Fix bug where NetStream would continue playback upon completion ( due to our not handling the new STOPPED state).

    Revision: 13028
    Revision: 13028
    Author:   [email protected]
    Date:     2009-12-16 18:10:28 -0800 (Wed, 16 Dec 2009)
    Log Message:
    Fix bug where NetStream would continue playback upon completion (due to our not handling the new STOPPED state).  Injection from trait refactoring.
    Modified Paths:
        osmf/trunk/framework/MediaFramework/org/osmf/net/NetStreamPlayTrait.as

    My daughter has had her Razr for about 9 months now.  About two weeks ago she picked up her phone in the morning on her way to school when she noticed two cracks, both starting at the camera lens. One goes completely to the bottom and the other goes sharply to the side. She has never dropped it and me and my husband went over it with a fine tooth comb. We looked under a magnifying glass and could no find any reason for the glass to crack. Not one ding, scratch or bang. Our daughter really takes good care of her stuff, but we still wanted to make sure before we sent it in for repairs. Well we did and we got a reply from Motorola with a picture of the cracks saying this was customer abuse and that it is not covered under warranty. Even though they did not find any physical damage to back it up. Well I e-mailed them back and told them I did a little research and found pages of people having the same problems. Well I did not hear from them until I received a notice from Fed Ex that they were sending the phone back. NOT FIXED!!! I went to look up why and guess what there is no case open any more for the phone. It has been wiped clean. I put in the RMA # it comes back not found, I put in the ID #, the SN# and all comes back not found. Yet a day earlier all the info was there. I know there is a lot more people like me and all of you, but they just don't want to be bothered so they pay to have it fix, just to have it do it again. Unless they have found the problem and only fixing it on a customer pay only set up. I am furious and will not be recommending this phone to anyone. And to think I was considering this phone for my next up grade! NOT!!!!

  • The status and statement about Oracle embrace JavaServer Faces

    Hi all:
    Have any expert could talking about the status and statement about Oracle embrace JavaServer Faces standard,
    whether Jdeveloper 10g have full support this standard now, and UIX direction ?

    development based on oracle technology and tool, If we wish adopt JavaServerFace technology, we should direct using Sun Java standard library or oracle UIX technology,
    give us some suggestion, how to start JavaServerFace application development ? is start from UIX ? and what is learning step ?

  • The new "foreach" statement and maps

    The new "foreach" statement requires an object that implements the java.lang.Iterable<T> interface.
    But why do not extend "for" for accepting objects that implements the Map interface?
    Map<String,String> m = new TreeMap<String,String>();
    for (String key, String value : m) {
         System.out.println (key + "=" + value);   
    }The current alternative
    Map<String,String> m = new TreeMap<String,String>();
    for (Map.Entry<String,String> e : m.entrySet()) {
         System.out.println (e.getKey() + "=" + e.getValue());   
    }is not so clean.

    The new "foreach" statement requires an object that
    implements the java.lang.Iterable<T> interface.Incidentally, I believe "foreach" also allows an object that is an array.
    But why do not extend "for" for accepting objects that
    implements the Map interface?I think that the use of "Iterable" is a very good idea. The interface contains just one method (iterator) and that method is inherently linked to the concept of "foreach". This means anyone can write their own class that implements Iterable, and their class can then be used with "foreach".
    If we specified that "foreach" also worked with Map (with its umpteen methods, only one of which (entrySet) is relevant to "foreach"), this would prevent people writing their own classes which iterate through pairs of values (unless those classes happened to implement Map).
    Ideally, there would be a new interface Pair<A,B> in java.lang (with getFirst() and getSecond() methods), and then if the compiler came across something like this:
        for (String str, Widget widget : items) { ... }where items is an instance of Iterable<Pair<String,Widget>>, then for each iteration, the "Pair" would be split into its component parts and stored in the variables "str" and "widget".
    Unfortunately, it would be difficult to retrofit this concept to java.util.Map, since it would require Map to introduce a new method:
    interface Map<K,V> extends Iterable<Pair<K,V>> {
        Iterator<Pair<K,V>> iterator();
    }and Map.Entry would need to extend Pair, and therefore introduce two new methods:
    interface Entry<K,V> extends Pair<K,V> {
        K getFirst();
        V getSecond();
    }Both of these changes would break huge amounts of existing code that uses Map or Map.Entry.
    Maybe one for Java 3 :)
    Geoff

  • Instead of trigger is NOT firing for merge statements in Oracle 10gR2

    The trigger fires fine for a update statement, but not when I use a merge statement
    with an update clause. Instead I get the normal error for the view ( which is a union all view, and therefore not updatable.)
    The error is :-
    ORA-01733: virtual column not allowed here
    oracle release is 10.2.0.2 for AIX 64L
    Is this a known bug ?
    I've used a multi-table insert statement to work around the problem for inserts, but
    for updates, I'd really like to be able to use a merge statement instead of an update.
    Mark.

    This is my cut-down version :-
    In this case case I'm getting an :-
    ORA-01446: cannot select ROWID from, or sample, a view with DISTINCT, GROUP BY, etc.
    rather then the ora-01733 error I get in the real code ( which is an update from an involved
    XML expression - cast to a table form)
    create table a ( a int primary key , b char(30) ) ;
    create table b ( a int primary key , b char(30) ) ;
    create view vw_a as
    select *
    from a
    union all
    select *
    from b ;
    ALTER VIEW vw_a ADD (
    PRIMARY KEY
    (a) DISABLE);
    DROP TRIGGER TRG_IO_U_ALL_AB;
    CREATE OR REPLACE trigger TRG_IO_U_ALL_AB
    instead of update ON vw_a
    for each row
    begin
    update a targ
    set b = :new.b
    where targ.a = :new.a
    if SQL%ROWCOUNT = 0
    then
         update b targ
         set b      = :new.b
         where targ.a = :new.a
    end if ;
    end ;
    insert into a values (1,'one');
    insert into a values (2,'two');
    insert into a values (3,'three');
    insert into b values (4,'quatre');
    insert into b values (5,'cinq');
    insert into b values (6,'six');
    commit;
    create table c as select a + 3 as a, b from a ;
    commit;
    merge into vw_a targ
    using (select * from c ) src
    on ( targ.a = src.a )
    when matched
    then update
    set targ.b = src. b
    select * from vw_a ;
    rollback ;
    update vw_a b
    set b = ( select c.b from c where b.a = c.a )
    where exists ( select c.b from c where b.a = c.a ) ;
    select * from vw_a ;
    rollback ;

  • Doubt Regarding Merge Statement in Oracle

    Hi,
    I have an SP which takes 3 parameters Lets say
    (in_empid, in_empname,in_age)
    here in_empid corresponds to the empid ie primary key for update/insert
    Now which of the approach will be better. Will there be problem in using Merge statements for updates/insert
    1. Approach 1
    Add one more flag in parameters in_action . Now if in_action = 'U' then write an update statement.If in_action='I' then write insert stmnt
    2. Approach 2
    write a merge stmnt as follows
    merge into employee e using
    ( select in_empid, in_empname,in_age from dual ) b
    on  ( b.in_empid = e.empid)
    WHEN MATCHED THEN
      UPDATE SET e.ENAME = in_empname,
                           e.age = in_age
    WHEN NOT MATCHED THEN
      INSERT
      VALUES (in_empid,in_empname,in_age) something like that
    Which would be preferred? I mean is there any restriction that merge can be used only to merge 2 tables?what are the drawbacks of using Merge?
    Regds,
    S

    Hi cd,
    Thanks for the reply.
    Actaully I was keeping the front-end code also in mind.
    If we click an update button, then they will have to manage a flag till the end to say that transaction was update. whereas when its an insert of new record, they have to maintain a falg till end to imply that the transaction was insert.
    I want to avoid this so that they need not maintain additional flag.
    Hence I was thinking of using MERGE statement.
    Will there be any problem in using merge for such scenarios?
    Regds,
    S

  • HT5654 I have a new computer, Windows 8.  My old laptop died and I used to Sync my iPad and iPhone on that device.  Now I want to update, the new computer states that I do not have permission.  How do i change permissions to this new computer?

    I have a new computer, Windows 8.  My old laptop died and I used to Sync my iPad and iPhone on that device.  Now I want to update, the new desktop computer states that I do not have permission.  How do I change permissions to this new computer?

    Did you authorize it?

  • Error in Merge statement for Oracle 10gR2

    Hi,
    When I use the MERGE statement to copy data across a database link (from 10gR2 to 10gR2 database), if I have both an update and insert clause it works fine, but if I omit the insert clause and have just update on its own, I get error "ORA-02064: distributed operation not supported".
    Can anyone help on this

    This came up in a thread last week, the 10g versions of MERGE (without INSERT or with DELETE) did not appear to work over DB links.

  • Merge Statement in Oracle

    I have two tables.Table 1 and Target.
    I am using Table 1 as source to update records in target table.
    I am joining the two tables on common column named ID. Datatype for ID in table 1 is VARCHAR whereas it is NUMBER in target table.
    Also, Updatedate column have datatype VARCHAR in table 1 whereas it is TIMESTAMP in target table.
    I am using the following code but getting errors:
    1. Error in executing ODCIEXTTABLEFETCH
    2.NON-NUMERIC character is found where a numeric was expected
    Code i am using:
    MERGE
    INTO target tgt
    USING (select
    to_numbet(ID),
    ADDRESS,
    CITY,
    STATE,
    COUNTRY,
    ZIP
    from TABLE1 a,target b where a.ID = b.ID and
    to_date(a.updatedate,'mm/dd/yyyy') > (select max(updatedate) from target)and rownum < 100) src
    ON (src.ID = tgt.ID)
    WHEN MATCHED
    THEN
    UPDATE
    SET tgt.address = src.address,
    tgt.city = src.city,
    tgt.state = src.state,
    tgt.zip = src.zip,
    tgt.country = src.country
    WHEN NOT MATCHED
    THEN
    INSERT (ID,address,city,zip,state,country)
    VALUES (src.ID,src.address,src.city,src.zip,src.state,src.country)
    Please suggest some solution to rectify this issue.
    Thanks

    user11018028 wrote:
    I have two tables.Table 1 and Target.
    I am using Table 1 as source to update records in target table.
    I am joining the two tables on common column named ID. Datatype for ID in table 1 is VARCHAR whereas it is NUMBER in target table.
    Also, Updatedate column have datatype VARCHAR in table 1 whereas it is TIMESTAMP in target table.
    I am using the following code but getting errors:
    1. Error in executing ODCIEXTTABLEFETCH
    2.NON-NUMERIC character is found where a numeric was expected
    Code i am using:
    MERGE
    INTO target tgt
    USING (select
    to_numbet(ID),
    ADDRESS,
    CITY,
    STATE,
    COUNTRY,
    ZIP
    from TABLE1 a,target b where a.ID = b.ID and
    to_date(a.updatedate,'mm/dd/yyyy') > (select max(updatedate) from target)and rownum < 100) src
    ON (src.ID = tgt.ID)
    WHEN MATCHED
    THEN
    UPDATE
    SET tgt.address = src.address,
    tgt.city = src.city,
    tgt.state = src.state,
    tgt.zip = src.zip,
    tgt.country = src.country
    WHEN NOT MATCHED
    THEN
    INSERT (ID,address,city,zip,state,country)
    VALUES (src.ID,src.address,src.city,src.zip,src.state,src.country)
    Please suggest some solution to rectify this issue.
    ThanksID column contains non-numeric data

  • Issue with Oracle Merge statements (PL/SQL: ORA-00913: too many values)

    Hi All,
    I am using the below merge statement and I am getting too many rows issues when I am compiling.
    BEGIN
    FOR te_rec IN ( SELECT /*+ parallel(ts,4) */ te.dtv_acct_num FROM telcos_eligible te, telcos_setup ts, telcos_partners tp
    WHERE tp.telcos_name = UPPER((p_telcos_name))
    AND ts.partner_id = tp.partner_id
    AND te.ts_id = ts.ts_id ) LOOP
    MERGE INTO tcs_accounts
    USING (
    SELECT /*+ DRIVING_SITE(a) */account_id, a.subscriber_id, status, account_type FROM account@tcs_to_paris a WHERE a.subscriber_id = te_rec.dtv_acct_num
    ) paris_accounts
    ON (tcs_accounts.subscriber_id = paris_accounts.subscriber_id)
    WHEN MATCHED THEN
    UPDATE SET
    account_type = paris_accounts.account_type,
    subscriber_id = paris_acounts.subscriber_id,
    status = paris_accounts.status
    WHEN NOT MATCHED THEN
    INSERT(account_id, subscriber_id, status_account_type)
    VALUES(paris_accounts.account_id, paris_accounts.subscriber_id, paris_accounts.status, paris_accounts.account_type);
    END LOOP;
    END;
    Can you let me know what is the issue here.
    Thanks,
    MK.

    Hi,
    Maddy wrote:
    ... WHEN NOT MATCHED THEN
    INSERT(account_id, subscriber_id, status_account_type)
    VALUES(paris_accounts.account_id, paris_accounts.subscriber_id, paris_accounts.status, paris_accounts.account_type);This is one of the many times when a little formatting can really help you. Anybody can forget a column (or have an extra one, or type a _ when they mean ,) but if you write code like this
    INSERT (               account_id,                 subscriber_id,                                  status_account_type)
    VALUES (paris_accounts.account_id,  paris_accounts.subscriber_id,  paris_accounts.status,  paris_accounts.account_type);you might spot the error yourself.
    Always format your code. When you post any formatted text on thsi site, type these 6 characters:
    \(small letters only, inside curly brackets) before and after formatted text, to preserve spacing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Locking in Merge Statement

    Hi All,
    I am using merge statement to insert and update rows. The merge statement takes a row level exclusive lock
    Suppose the select statement returns 1 Million records does
    1) The merge statement first tries to lock all the affected rows and then update / insert records.
    OR
    2) The merge statement aquires lock on an incremental basis as returned by the select statement.

    The merge works just like an insert or update statement in that locks are acquired "on an incremental basis", but as of the timestamp the merge began. When Oracle detects that another session has updated a row in the meantime, then it re-executes the entire merge statement as of that new timestamp. It is sometimes referred to as "write consistency".
    Here is a good Asktom thread on this topic: http://asktom.oracle.com/pls/asktom/f?p=100:11:1694097844551766::::P11_QUESTION_ID:11504247549852
    Regards,
    Rob.

  • A bug with the new WebView??

    <font color="blue" size="2" >Hi I'm using javaFX 2.1 with Netbeans 7.2 and java 1.7.5. When trying to run this with WebView shows the error down below. The starnge thing it´s I have and old version of other code and runs without any trouble. Does anybody knows why this happens?. Thanks in advanced.</font>
    <font color="red" size="4" > Here's the code:</font>
    public class AEjemploArrays extends Application {
        private Button btn = new Button();
        private WebView web = new WebView(); //comment this and will work
        @Override
        public void start(Stage stage) {
            StackPane root = new StackPane();
            Scene scene = new Scene(root, 1200, 500);
            BorderPane bp0 = new BorderPane();
            ObservableList<String> titulos = FXCollections.observableArrayList("ArrayList", "Vector", "HashSet", "HashMap");
            ListView<String> lista = new ListView<>(titulos);
            lista.prefHeightProperty().bind(scene.heightProperty().add(-10f));
            lista.setMaxWidth(250);
            lista.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
                @Override
                public void changed(ObservableValue<? extends Number> ov, Number oldv, Number newv) {
                    System.out.println("" + newv.doubleValue());
            btn.setText("Ejecutar");
            btn.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent event) {
                    System.out.println("Hello World!");
            bp0.setLeft(lista);
            root.getChildren().add(bp0);
            stage.setTitle("Diversos arrays y como funcionan");
            stage.setScene(scene);
            stage.show();
        }<font color="red" size="4" > Error message:</font>
    <font color="darkblue" size="3" >ant -f C:\\Users\\ANDRES\\Documents\\NetBeansProjects\\aEjemploArrays jfxsa-run
    init:
    Deleting: C:\Users\ANDRES\Documents\NetBeansProjects\aEjemploArrays\build\built-jar.properties
    deps-jar:
    Updating property file: C:\Users\ANDRES\Documents\NetBeansProjects\aEjemploArrays\build\built-jar.properties
    Compiling 1 source file to C:\Users\ANDRES\Documents\NetBeansProjects\aEjemploArrays\build\classes
    compile:
    Detected JavaFX Ant API version 1.1
    Launching <fx:jar> task from C:\Program Files\Oracle\JavaFX 2.1 SDK\lib\ant-javafx.jar
    Launching <fx:deploy> task from C:\Program Files\Oracle\JavaFX 2.1 SDK\lib\ant-javafx.jar
    Skip jar copy to itself: aEjemploArrays.jar
    jfx-deployment:
    jar:
    run:
    Exception in Application constructor
    java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
         at java.lang.reflect.Method.invoke(Method.java:601)
         at com.javafx.main.Main.launchApp(Main.java:486)
         at com.javafx.main.Main.main(Main.java:638)
    Caused by: java.lang.RuntimeException: Unable to construct Application instance: class aejemploarrays.AEjemploArrays
         at com.sun.javafx.application.LauncherImpl.launchApplication1(Unknown Source)
         at com.sun.javafx.application.LauncherImpl.access$000(Unknown Source)
         at com.sun.javafx.application.LauncherImpl$1.run(Unknown Source)
         at java.lang.Thread.run(Thread.java:722)
    Caused by: java.lang.reflect.InvocationTargetException
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
         ... 4 more
    Caused by: java.lang.IllegalStateException: Not on FX application thread; currentThread = JavaFX-Launcher
         at com.sun.javafx.tk.Toolkit.checkFxUserThread(Unknown Source)
         at com.sun.javafx.tk.quantum.QuantumToolkit.checkFxUserThread(Unknown Source)
         at com.sun.webpane.sg.prism.InvokerImpl.checkEventThread(Unknown Source)
         at com.sun.webpane.platform.WebPage.<init>(Unknown Source)
         at com.sun.webpane.sg.ImplementationManager.createPage(Unknown Source)
         at com.sun.webpane.sg.ImplementationManager.createPage(Unknown Source)
         at javafx.scene.web.WebEngine.<init>(Unknown Source)
         at javafx.scene.web.WebEngine.<init>(Unknown Source)
         at javafx.scene.web.WebView.<init>(Unknown Source)
         at aejemploarrays.AEjemploArrays.<init>(AEjemploArrays.java:29)
         ... 8 more
    Java Result: 1
    jfxsa-run:
    BUILD SUCCESSFUL (total time: 24 seconds)</font>

    Move the new WebView statement into the Start method and all will work fine.
    As the error message says, a WebView needs to be created on the FX Application thread. By trying to create the WebView where you currently are doing it, the creation attempt will be performed on the main thread.
    There is an existing Jira issue to remove the thread restriction on WebView, but it is scheduled for a later release.

  • New features present in oracle 11gr2.

    Hi all,
    I would like to know the new features present in oracle 11gR2. Any pointers would be helpful.
    Example: list aggregate features is not there in 11gR1... etc.
    Thanks and Regards
    Nagaraja Akkivalli.

    SQL New Features:
    Performance improvements
    1.Alter table to add columns with default value.
    2.Invisible Indexes
    3.Redefinition improvements
    4.SQL Result cache
    New Language features
    1.New data types: SIMPLE_INTEGER, SIMPLE_FLOAT, SIMPLE_DOUBLE
    2.Regular Expressions:regexp_count
    3.Read Only Table
    4.Virtual Columns
    5.Partitioning:Interval Partitioning,System Partitioning,Reference Partitioning,Virtual Column-Based Partitioning
    6.IGNORE_ROW_ON_DUPKEY_INDEX hint
    7.Analytic functions – NTH_VALUE ,LISTAGG
    8.SecureFiles
    9.Pivot query
    PL/SQL New Features:
    1.Real Native Compilation
    2.DML triggers are faster
    3.Compound triggers
    4.Fine grained dependency Intra unit inlining
    5.PL/SQL result cache
    6.OCI Result Set Caching
    New Language features:
    1.Disabled Trigger
    2.FOLLOWS keyword in Trigger
    3.PLW-006009 warning
    4.Continue statement
    5.Enhancements in Dynamic SQL

  • MERGE: unexpected behaviour, oracle 11g

    Hi all,
    I'm facing a strange behaviour with Merge statement.
    In particular in doc Oracle we read:
    "MERGE is a deterministic statement. That is, you +*cannot update*+ the same row of the target table multiple times in the same MERGE statement."
    My source table has two equal key rows and the "merge statement" merge the row with the last value in the source table.
    How Is this possible ?
    thank you.

    VERSION:
    SQL> select * from v$version
      2  ;
    BANNER
    Oracle Database 11g Release 11.2.0.1.0 - 64bit Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 64-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    SQL>MERGE, in a dynamic context:
    v_sql :=
    'MERGE INTO dwh_cdl.dim_cost_hierarchy dim
             USING (SELECT DISTINCT TRIM (item_code) id_item,
                                    NVL (TRIM (CATEGORY), ''ND'') CATEGORY,
                                    r1.r1_code r_1,
                                    r2.r2_code r_2,
                                    r3.r3_code r_3,
                                    r4.r4_code r_4,
                                    w.item_description desc_item
                                            FROM '
                                            || v_wrk
                                            || ' w INNER JOIN dwh_cdl.lu_r1 r1
                                                 ON (w.r_1 = r1.r1_code)
                                                 INNER JOIN dwh_cdl.lu_r2 r2
                                                 ON (w.r_2 = r2.r2_code)
                                                 INNER JOIN dwh_cdl.lu_r3 r3
                                                 ON (w.r_3 = r3.r3_code)
                                                 INNER JOIN dwh_cdl.lu_r4 r4
                                                 ON (w.r_4 = r4.r4_code)
                                    ) wrk
             ON (    dim.id_item = wrk.id_item
                 AND dim.category = wrk.category
                 AND dim.r1_code = wrk.r_1
                 AND dim.r2_code = wrk.r_2
                 AND dim.r3_code = wrk.r_3
                 AND dim.r4_code = wrk.r_4
                 AND dim.wid_country = '
                || pkg_global.v_country
                || ')
             WHEN MATCHED THEN
                UPDATE
                   SET dim.desc_item = wrk.desc_item
             WHEN NOT MATCHED THEN
                INSERT (wid_item, id_item, CATEGORY, desc_item, type_item,
                        flag_valid, r1_code, r2_code, r3_code, r4_code,
                        wid_country, date_in)
                VALUES (pkg_util.get_next_val (''DIM_COST_HIERARCHY''), wrk.id_item,
                        wrk.CATEGORY, wrk.desc_item, NULL, 1, r_1, r_2, r_3, r_4,
                || pkg_global.v_country
                || ', SYSDATE)';
    EXECUTE IMMEDIATE v_sql;The USING table has duplicate key rows. So when join with "dim_cost_hierarchy" Oracle should issue error ! But, it doesn't !
    It gets the last one row value.

Maybe you are looking for

  • Back-ups with and without Time Machine + G -MINI

    I've got a problem with my new G - MINI 500GB running on an iMac intel 10.5.1/ 230GB. I hope someone can help me with this. Overview of problem: I need more hard disc space and opted for an external drive. I would have got a G _Tech Q 500 gb drive bu

  • HP Photosmart B9180 not printing black

    i am not getting black ink on any of my prints i used the printer the other day and it was fine the black ink cart is at about 88% i did get a message about ink carts that had expired but ignored it as i always do so i am not sure if this is the caus

  • Missing Text In Pages 08 Document

    I'm having an issue with a Pages 08 document. I recently opened it and seemingly random chunks of text are missing. The document retains the original formatting, so it looks as if the "missing" text was turned to white. But, that is not the case. It

  • Trex queue return error: code 6002, QS error: queue not found

    Hi all,    in TREX Administrator tool, in the queue area I see "index01". When I try to perform some operation I receive the error QS error: queue not found. I check services status and I see that queueserver isn't running. I stop the TREX server, de

  • HELP I can't publish my lab homepage to my university server

    I can't publish my new homepage to my space on my University's server and I really don't understand all the other suggestions in the other threads about editing html, etc .... That's why I bought iLife in the first place....to simplify my life. I hav