Can't generate Merge statement in OWB

Hi All,
I'm facing a very strange problem in OWB. Version is 9.0.3. I have a target table which has its properties set to INSERT/UPDATE and I have set one of its fileds to be the one used for matching. However when generating the code, OWB is generating only an INSERT statement and not a MERGE as I'd expect. The table is very simple, it has 4 columns, 1 of which I will be using to match on. the properties of them are:
Load on Insert Load on Update Use for Matching
F1 Y Y N
F2 Y Y N
F3 Y Y N
F4 N N Y
The module in which this mapping was created is pointing to an Oracle8i/9i DB. All other mappings when created in a seperate module with this project CAN generate the Merge...strange!
I have used the Merge statement successfully on many other mappings but at this client site I'm having problems
Any help would me most appreciated.
Take care
Mitesh

Thanks for your reply. My target table does not have any contraints on it and that is why in the properties in OWB I have selected the value "no contraints" for "match by constrainsts". I have then set one of the 4 fields to:
Insert:Use for loading = No
Update:Use for loading = No
Update:Use for matching = Yes
The other threee columns are set to:
Insert:Use for loading = Yes
Update:Use for loading = Yes
Update:Use for matching = No
The table Loading/Type is Insert/Update but I'm still not getting the merge to work. I really am not sure if this is a Java bug or not. I have deleted the mapping and created it from scratch but I get the same problem. Then next point of call I think would be to create a new module within my projects - but its just strange how other moules in this same project work with merge.
Thanks
Mitesh

Similar Messages

  • Why does OWB generate merge statement when target type = Update

    Hi there
    getting problem message cannot generate merge. I don't undretand why even trying to ctreate a merge when should be an update and then sql would be fine.
    trying to update a table whose expiry date = '31-DEC-4000' (via raget filter for update
    and also put value from src into this field.
    This would be ok in sql
    update table
    set col = new_value
    where col = 31-dec-4000'
    Any thoughts - it seems strange why OWB generate a merge when set target type to Update since other target types of Update/Insert and Insert/Update available to generate merge.
    Many Thanks

    I understand what you are trying to say...
    One simple workaround for this is: In the mapping, add one more column in the target table eg: match_val. Set the bound name to match column eg: col.
    Set the one match_val attribute properties to "match column when updating" & actual column eg: col attribute properties to "Load column when updating".
    This will generate merge statement for your requirements. This will help u.

  • "VLD-2780: Unable to generate Merge statement".

    Folks,
    I am trying to validate my mapping before deployment but I am getting the following error: "VLD-2780: Unable to generate Merge statement".
    - I am mapping 5 tables from my source to one table in my target by using a joiner.The primary key in my target table is also my synthetic key. (I have created a sequence on the primary key)
    -When the "Match by constraint" in the operator properties of the target table is set to "All constraints" I get the VLD-2780 error message during validation.
    - However when the "Match by constraint" is set to "No constraints" I can generate the merge statement in my intermediate result but my validation is now giving me this message:"VLD-2750: Missing update matching criteria in TARGET_TABLE".
    - My synthetic key property is set as follow:
    Load Column when Inserting Row = Yes
    Load Column when Updating Row = No
    Match Column when Updating Row = No
    Update:Operation =
    Match Column when Deleting Row = Yes
    I have tried other options wihout much success. I can't seem to pass the validation step.
    Any help will be greatly appreciated.
    Thanks Much!

    There are two ways of matching incomming rows with rows present in a target table during updates. One is to use the key constraints. You can see this by inspecting the target object properties in the mapping and checking the 'Match by constraint' parameter. This is recommended in case you have defined key constraints on the target objects.
    The other (if match by constraints is set to 'no constraints') is to set the Match Column when Updating to yes (and conversely, Load Column when Updating to 'No') for individual columns that have to be matched (as sugested above).
    If you get the VLD-2750 message, it means that one of the target objects does not have any matching criteria set for updates. In an insert/update mapping you should use either the first or the second matching method for all your target objects.
    Regards:
    Igor

  • Re-doing complex Merge statement in OWB

    I have a complex merge written in sql that needs to be redone in owb.
    The code is something like this :
    MERGE INTO table_1
    USING (
    WITH u1 AS (SELECT STATEMENT 1....)),
    u2 AS (SELECT STATEMENT 2....)),
    u3 AS (SELECT STATEMENT 3....)),
    u4 AS (SELECT STATEMENT 4....)),
    u5 AS (SELECT STATEMENT 5....))
    SELECT *
    FROM (SELECT * FROM u1
    UNION
    SELECT * FROM u2
    UNION
    SELECT * FROM u3
    UNION
    SELECT * FROM u4
    UNION
    SELECT * FROM u5) a,b
    WHERE a.column1 = b.column1(+) ) table_2
    ON (table_1.id = table_2.id)
    when matched then update set....
    when not matched then insert...
    How do I implement some thing like above in OWB? Do i need to use pluggable mappings?
    any feedback would be of great help!
    Thanks
    Billu

    Hi Billu,
    no, you do not need pluggable mappings.
    Design your selects for u1 - u5 as required in one mapping. Then use a set operator (union) with 5 ingroups. Connect the results of your selects to each ingroup.
    Connect the output of the set operator to your target table table_1. Set loading type to insert/update (this will generate a merge statement). Use the column id for matching.
    Regards,
    Carsten.

  • How to change the merge condition in OWB generated code

    Hi,
    This is regarding the OWB generated code for cubes. We required to change the ON condition of MERGE statement. OWB merge the records on the basis of dimension keys only. Is there any ways to provide the customised merge condition or is it possible to add a measure of the cube to be used in ON condition of the merge?

    Hi,
    cant´t you customize the generated Code in the Database?
    I know that owb has the trait to do the following:
    If you create a Mapping, etc. the generated Code will be deployed as PL/SQL Package in the Database Schema.
    Now you can edit the Code as Schema User right in the Database.
    Don´t edit it in the Metadata, only in the Databse.
    If you run now any Process in OWB, he´ll execute your edited Code,
    ´cause he just takes whats still there. :-)
    It´s not realy clean, but in most Times that works.
    LoneWolf

  • Merge statement BUG!?

    Hi all,
    When i have a mapping that makes an INSERT/UPDATE at the end over a primary key, and i change the primary key, after the reconcile table the mapping validation gives 'Unable to generate Merge statement'.
    There's any way to avoid me to replace the table, and just do the reconcile inbound?
    Thanks,
    Vitor

    Hi,
    Probably i didn't make myself clear!
    Imagine, that i change my table Primary Key, then on the mapping i will make the Reconcile Inbound. At this moment it can't make the merge statement. So what i got to do is, remove the target table and insert it again. In the end i will have exactly what i had before. I just don't understand why the Reconcile Inbound is not enough, and had to replace the table.
    To me this is a BUG because i will not change anything on the mapping structure, it just can't transpose the changes made on the primary key to the merge statement using the reconcile!!
    Regards,
    Vitor

  • Merge statements in Pro*C

    First I tried doing the following:
    EXEC SQL
    MERGE INTO <table>
    ect. etc.
    And got Encountered the symbol "MERGE" when expecting one of the following:
    for, register, at, close, commit, connect, declare, describe,
    execute, fetch, open, prepare, rollback, select, whenever,
    alter, audit, comment, create, delete, drop, get, grant,
    insert, lock, noaudit, rename, revoke, set, update, validate,
    arraylen, allocate, cache, call, collection, context,
    deallocate, enable, free, lob, object, savepoint, analyze,
    explain, truncate,
    I later found out that you can't embed MERGE statements like that. So instead I tried to embed it as a PL/SQL block.
    EXEC SQL EXECUTE
    BEGIN
    MERGE INTO <table>
    USING (..)
    ON (..)
    WHEN MATCHED ..
    WHEN NOT MATCHED ..
    END;
    END-EXEC;
    And got the following: "MERGE INTO BENEFITS.BROKER_INFORMATION D
    PLS-S-00103, Encountered the symbol "INTO" when expecting one of the following:
    Does Pro*C just flat out hate merge statements?

    Hi,
    I tried out, exactly the same as you tried..
    Looks like the ANSI Pro C ompiler is not equiped to compile Merge statement.
    So if we can get the compiler not touch the Merge statement, our job is done.
    The work around is as follows:
         /*SQL Declarations*/
              EXEC SQL BEGIN DECLARE SECTION;
                        char O_str1[1024];
                        EXEC SQL VAR O_str1 IS STRING (1024);
              EXEC SQL END DECLARE SECTION;
              strcpy(O_str1,"MERGE INTO .....");
         /*SQL query to be executed*/
              EXEC SQL PREPARE curSqlStmt FROM :O_str1;
    Please try and respond, it worked for me...
    Regds
    Santosh Iyengar

  • Help needed on Merge statement

    Hi,
    I want to merge a record which has a LONG field to a table with LOB field.
    Am getting error "ORA-00932: inconsistent datatypes: expected - got LONG" at "to_lob(col2) " in the query. Please help in resolving this.
    Thanks
    RK
    MERGE INTO message_STG d
    USING (SELECT col1,to_lob(col2) col2
         FROM message jm
         WHERE modificationdate >= <some_date_value> ) f
    ON (d.MESSAGEID= f.MESSAGEID)
    WHEN matched THEN
    UPDATE SET
    col1=f.col1,
    col2=f.col2
    WHEN NOT matched THEN
    INSERT VALUES (f.col1,f.col2);

    Am getting error "ORA-00932: inconsistent datatypes: expected - got LONG" at "to_lob(col2) "If you read the documentation you will discover that to_lob() only works in an insert statement.
    What you will have is create a holding table with a CLOB column and insert all your MESSAGE records into it, doing the TO_LOB() there. Then you can drive your MERGE statement from that holding table.
    Is this a one-off data migration exercise or something you'll have to do regularly?
    Cheers, APC
    Blog : http://radiofreetooting.blogspot.com/

  • Can sql merge statement be used in a batch (oracle 10g)?

    Hello,
    I am trying to insert into an oracle table multiple rows of values selected from a web page. Can I use a merge statement as a preparedStatement to avoid inserting duplicate records?
    Does anybody have any examples they would like to share?
    Any suggestions are greatly appreciated.
    Thank you,
    Logan

    I've implemented this by batch inserting into a temp table then running a merge then dropping the temp table.
    public void mergeMethod() {
            final String createsql = "CREATE TABLE temp (a INTEGER, b INTEGER, c INTEGER)";
            final String insertsql = "INSERT INTO temp (a, b, c) VALUES (?,?,?)";
            final String mergesql = "MERGE INTO my_table A " +
               "USING temp B ON (A.a = B.a AND A.b = B.b) " +
               "WHEN MATCHED THEN UPDATE SET A.c = B.c " +
               "WHEN NOT MATCHED THEN INSERT (A.id, A.a, A.b, A.c) " +
               "VALUES (my_seq.Nextval,B.a,B.b,B.c)";
            final String dropsql = "DROP TABLE temp";
         Connection conn = null;
         Statement cs = null;
         Statement ms = null;
         Statement ds = null;
         PreparedStatement ps = null;
         boolean retValue = false;
         try {
              conn = getConnection();
              conn.setAutoCommit(false);
              cs = conn.createStatement();
              ms = conn.createStatement();
              ds = conn.createStatement();
              ps = conn.prepareStatement(insertsql);
              for (int i=0; i< 10; i++){
                   ps.setInt(1, i);
                   ps.setInt(2, i+1);
                   ps.setInt(3, i+2);
                   ps.addBatch();
              // create temp table
              cs.execute(createsql);
              // execute in batch
              final int updateCount[] = ps.executeBatch();
              // merge the two tables
              ms.execute(mergesql);
              // drop the temp table
              ds.execute(dropsql);
              conn.commit();
              System.out.println("Rows is updated: " + updateCount.length);
         } catch (final SQLException e) {
              if (conn != null) {
                  conn.rollback();
              throw e;
         } finally {
              if (ps != null) {
                  ps.close();
              if (cs != null) {
                  cs.close();
              if (ms != null) {
                  ms.close();
              if (ds != null) {
                  ds.close();
              if (conn != null) {
                  conn.close();
    }

  • Can u rectify the error  in merge statement in sql

    hi to all,
    i had created a duplicate table of emp with the name of copy_emp with no records.
    by using merge statement i want to update the existing rows and insert new rows into copy_emp table as follows ......
    merge into copy_emp c
    using emp e
    on(c.empno=e.empno) --------> here the error is ........ invalid column name
    when matched then
    update set c.empno=e.empno,.....
    when not matched then
    insert values(e.empno,e.job,e.sal........);

    merge into copy_emp c
    using emp e
    on(c.empno=e.empno) --------> here the error is ........ invalid column name
    when matched then
    update set c.ename=e.ename,.....
    when not matched then
    insert values(e.empno,e.job,e.sal........);
    take off empno from update clause.

  • Can you explain this error message with MERGE statement

    Here is the code that gives me headache.
    I give you the description of the two tables involved and the error message I get when I run a simple MERGE statement
    SQL> desc employees
    Name Null? Type
    EMPLOYEE_ID NOT NULL NUMBER(6)
    FIRST_NAME VARCHAR2(20)
    LAST_NAME NOT NULL VARCHAR2(25)
    EMAIL NOT NULL VARCHAR2(25)
    PHONE_NUMBER VARCHAR2(20)
    HIRE_DATE NOT NULL DATE
    JOB_ID NOT NULL VARCHAR2(10)
    SALARY NUMBER(8,2)
    COMMISSION_PCT NUMBER(2,2)
    MANAGER_ID NUMBER(6)
    DEPARTMENT_ID NUMBER(4)
    SQL> desc emp2
    Name Null? Type
    EMPLOYEE_ID NOT NULL NUMBER(6)
    FIRST_NAME VARCHAR2(20)
    LAST_NAME VARCHAR2(25)
    1 MERGE INTO emp2 e2
    2 USING employees e
    3 ON (e2.employee_id = e.employee_id)
    4 WHEN MATCHED THEN
    5 UPDATE SET
    6 e2.employee_id = e.employee_id,
    7 e2.last_name = e.last_name,
    8 e2.first_name = e.first_name
    9 WHEN NOT MATCHED THEN
    10 INSERT VALUES
    11 (e.employee_id,
    12 e.last_name,
    13* e.first_name)
    14 /
    ON (e2.employee_id = e.employee_id)
    ERROR at line 3:
    ORA-00904: "E2"."EMPLOYEE_ID": invalid identifier
    Any responce much appreciated

    Hi,
    Columns going to be updated should not be in 'ON clause' , try to delete the line 6 of your query. By the way, there isno sense to update e2.employee_id = e.employee_id when matched, the equality is already verified.
    Nicolas.

  • MERGE Statement - unable to get a stable set of rows in the source tables

    OWB Client: 10.1.0.2.0
    OWB Repository: 10.1.0.1.0
    I am trying to create a MERGE in OWB.
    I get the following error:
    ORA-12801: error signaled in parallel query server P004 ORA-30926: unable to get a stable set of rows in the source tables
    I have read the other posts regarding this and can't seem to get a fix.
    The target table has a unique index on the field that I am matching on.
    The "incoming" data doesn't have a unique index, but I have checked and confirmed that it is unique on the appropriate key.
    The "incoming" data is created by a join and filter in the mapping and I'd rather avoid having to load this data into a new table and add a unique index on this.
    Any help would be great.
    Thanks
    Laura

    Hello Laura,
    The MERGE statement does not require any constraints on its target table or source table. The only requirement is that two input rows cannot update the same target row, meaning that all existing target rows can be matched by at most one input row (otherwise the MERGE would be undeterministic since you don't know which of the input rows you would end up with in the target).
    If a table takes ages to load (and is not really big) I suspect that your mapping is not running in set mode and that it performs a full table scan on source data for each target row it produces.
    If you ARE running in set mode you should run explain plan to get a hint on what is wrong.
    Regarding your original mapping, try to set the target operator property:
    Match by constraint=no constraints
    and then check the Loading properties on each target column.
    Regards, Hans Henrik

  • Can we use Loop Statement for Ranges

    Hi Friends,
    I have a range say R_Range. I need to loop at each line item and get the values in another range R_New_Range, i have to count the number of items in R_new_range. How is it possible.
    I know range is nothing but an internal table. So we can direcly use Move statements or so ...,
    But my question is .....
    My R_range has values as below
    'I' 'EQ' '001'
    'I' 'EQ' '002'
    'I' 'BT' '003' '007'
    'I' 'EQ' '008'
    I have to move all these values to R_New_range and my count of items should be '8'.
    How can i do that????????
    Expecting ur answers....
    Thanks in advance
    Cheers,
    R.Kripa.

    hey friends,
    Its nice to see the replies.... but i think i had confused u all with the question
    Now i'll explain u all in detail ....
    See i have 15000 projects ( eg., AAA111... ) and 100 GL accounts ( eg., 123443... ) .....
    I have to get the costs from COSS and COSP tables for all the projects - GL account combinations which leads to some 1500000 entries ..... So it is giving me a SQL Dump "DBIF_RSQL_INVALID_RSQL" .........
    Description of the Dump is
    Error in the module RSQL accessing the database interface
    An exception occurred. This exception is dealt with in more detail below
    . The exception, which is assigned to the class 'CX_SY_OPEN_SQL_DB', was
    neither                                                                
    caught nor passed along using a RAISING clause, in the procedure        
    "GET_COSP_COSS" "(FORM)"                                               
    Since the caller of the procedure could not have expected this exception
    to occur, the running program was terminated.                          
    The reason for the exception is:                                        
    The SQL statement generated from the SAP Open SQL Statement violates a  
    restriction imposed by the database system used in R/3.                                                                               
    Possible errors:                                                        
    o The maximum size of an SQL statement has been exceeded.              
    o The statement contains too many input variables.                     
    o The space needed for the input data exceeds the available memory.    
    o ...                                                                               
    You can usually find details in the system log (SM21) and in the        
    developer trace of the work process (ST11).                             
    If an error occurs the developer trace often informs you about the      
    current restrictions.                                                   
    So now i want to fine tune the program so that the execution works perfectly and get me the values for all the data 1500000 :-|
    Now :
    My Projects are stored in the form of a range R_Range
    I have to loop at this range and then process 100 records at a time and then again take other 100 records .... i'll count till 100 records by getting loopaing at the range and for each loop pass i'll increment the counter ....
    I am clear till this .....
    If record consist of 'EQ' option .... then ofcourse we can consider the total record to be 1 record and we can add 1 to counter ......
    But if the record consist of 'BT' option ...... then how can we loop that and get the number of -low numbers in that range and add to my counter ????
    Hope iam clear with my question
    If not do revert back ....
    Thanks in advance for the replies
    Cheers,
    R.Kripa.
    My Doubt is ....

  • Merge statement

    i would like to know if it is possible to identify the row that is causing the problem when you use a merge statement in pl/sql. i know if you create a cursor and then loop through the data you can identify the column but what about if i have only a merge that will either insert or update. is it possible to identify which row of data cause the problem? thanks

    You can use an Error Logging Table<br>
    <br>
    Nicolas.

  • Merge Statement in PL/SQL

    Hi
    I am using a merge statement where i am updating and inserting records in table 2 from table 1.
    I want to log the no. of rows updated and new rows inserted in the log table.
    If i am not wrong, we can use sql%rowcount but i need help as how to use this statement.
    Please suggest a solution.
    Thanks

    user11018028 wrote:
    Will the sql%rowcount will give the no. of updated rows OR no. of newly inserted rows OR the sum of both in case of a merge statement.Total number of rows that changed (SUM).

Maybe you are looking for

  • Safari 5.1.2 crashing on bank's site since updated to Lion

    I'm desperate! Safari crashes (hangs) qhen I try to log on my banks site:  www.bancon.hn   I can enter homepage, bot can't do online banking (https://bancon.hn), I can enter user but site just hangs there and never asks for password, (this site uses

  • Non-displayable Chinese Characters

    I have found an interesting issue with iPod nano (not sure if this happens to other iPods as well) on displaying Chinese characters. There are some characters that couldn't be displayed in iPod nano, for example, if the song name contains 3 character

  • Apple Shop Lied!

    I just purchased a Time capsule and was looking forward to set it up, having had a conversation with a member of the apple team. Basically i purchase the TC to enable me to have a wireless external hard drive with 802.11n, and do it quickly. However,

  • Left clicking mouse acts as if I'm right clicking, and comes up with right click menu?

    Hi I was wondering whether anyone could help me with this, I've had this problem for a week or so now and it's beginning to get frustrating. I have a newish iMac, bought in January, and I've been having this problem the last week or so, where when I

  • How do I create specific movie fiolders

    Hello, How do you create sub folders for movies on my Ipod or through Itunes? I have many types of films from Sci Fi to action to horror and would like to organise them..into these catogaries instead of having them in one MOVIE folder.... Any help wo