Update/Insert key matching

I've got a table in OWB that has a surrogate key as the unique key and the natural key (matching the source data) as part of the orginal key and a lookup value that's part of a dimension in OWB.
I'm trying to figure out how to get OWB to match data to do an update/insert on the incoming data, but I keep getting VLD-2780 errors (saying that it can't update the surrogate key because it comes from a sequence). Duh..
The short of it is this:
Source_Table (key_part1, key_part2, key_part3)
Dest_table (surrogate_key, key_part1, dimension_key)
The dimension key is obtained from a key_lookup using key_part2 and key_part3 to return a single dimension key.
I have a PK on the surrogate key and a unique key on key_part1, dimension_key in the DEST table. The source_table has a PK across all three columns.
What's the proper way to tell OWB how to match data between teh two tables for an update/insert?
Thanks!

Hi!
Make sure to have the following properties set correcty in the mapping editor:
For the target table: "match by constraint" : choose the key yo want to use or "No constraints" if you do not wish to use any key.
For each attribute of the target table:
Loading properties:
Load column when updating: no for your matching fields, yes otherwise
Match column when updating: yes for your matching fields, no otherwise
Load column when inserting: yes
Load column when updating must be no for the primary key!
Regards,
Carsten.

Similar Messages

  • UPDATE/INSERT

    Hi All,
    My target table has two columns table_id and status. table_id is the primary key.
    I am doing an UPDATE/INSERT type of loading and match by constraint - "all constraints".
    The records should be updated by matching my primary key column - table_id.
    The mapping is running to success but showing some warnings... and not all soirce records are inserted/updated.
    I have two questions here -
    1.Is my loading strategy correct ??
    2. Where to see a detailed error log of these warnings ?
    Regds
    -Arnab

    Hello. If you have a primary key then select it as the driving constraint.
    It will then merge correctly using the single PK definition.
    Another very helpful thing to do is to set your mapping to SET BASED only and set errors to 2. This will allow the mapping to log the failure (seems to need 2 errors to log the first error) and will result in no records being inserted/updated on a failure. This will help you debug your mappings.
    Also you can generate aspects of your mapping to see the sql statement build up. This means to expand an operator and select a group level and right click choose generate intermediate, this will show sql leading into inputs, and leaving via outputs also very handy to see your mapping logic building up.
    Check the generate from the mapping editor this will show the logic for doing the merge, it will match on keys check its correct, cut and paste it into sql and debug it.
    Have fun.
    Regards,
    Richard Harrison.

  • OWB Update/Insert throwing unique constraint ..

    Hello Al,
    I am currently facing issue when it is supposed to update/Insert the records in OWB10gR2.
    Also there are no duplicates in the source data while doing this.
    Any help is appreceated.
    Thanks,
    Suresh
    Edited by: user8745316 on Jul 27, 2010 12:58 AM

    Hi Nawneet,
    Thanks for the reply.
    My issue is something like this , there were duplicates from the source and we deleted them but still it gives this error @ Unique constraint voilated errror.
    I also can understand that as we have same matching records by key columns from source and target which should ideally be doing the update and if non matching should be inserting which is not happening now.
    can you please suggest me the issue.
    Thanks for your help.
    Suresh

  • Problems with update/insert and the ON clause

    I have two rather identical mappings, both supporting SCD Type II. One of them works, the other one doesn't.
    As in the SCD whitepaper, I have a split, that ultimately ends in a union, and then UPDATE/INSERTs into the target dimension. My problem is, that though using the matching_id for matching in one mapping, it is not allowed in the second mapping. The error is ORA-38104: The columns refererred in the ON-Clause cannot be updated "MyTable.MyId" (all loosely translated).
    I just don't understand it, as it should be able to match the ID, and if not found, create a new record using INSERT.
    I found a description of the error that sounded like this (https://cwisdb.cc.kuleuven.ac.be/ora10doc/server.101/b10744/e38001.htm):
    ORA-38104: Columns referenced in the ON Clause cannot be updated: string
    Cause: LHS of UPDATE SET contains the columns referenced in the ON Clause
    Action: none
    I just don't understand how this can be a problem, since I have to carry the surrogate key along, in order to assure that the proper records gets updated...
    Anyone who can enlighten me on this one?
    Regards
    Kim

    Oh yes :) I was a quite active participant. What puzzles me is, that I cannot get mapping #2 to work. I have tried to do everything virtually alike, with regards to the surrogate key, and the extra mapping column.
    My setting for the keys are as below:
    Surrogate Matching
    Load column when inserting: yes no
    Load column when updating: yes no
    Match column when updating: no yes
    Load column when deleting: no no
    Table best viewed in notepad :)
    It "feels" like it's trying to update the surrogate key, instead of actually matching.
    Regards
    Kim

  • Is it possible to Update Remote Key

    Hi,
    I have a remote system which create remote key while syndicating to ERP...
    ERP will create the material number which inturn needs to be updated in MDM using import manager..
    While importing I am mapping Material number to remote key.. which is creating new remote key along with defualy remote key generated while
    syndication... Is it possible to have one key as it is of same material from  same system? And at the same time it is again syndicating after
    I import with material number (Remote Key)..
    Thanks
    Rajeev

    HI Ravi,
    by doing so I am having the dublicates in the Data Manager...
    Steps I peffromed :
    I have a main table of fields FName(DF),LName,City ....I created a remote Sytem (Remote1) with range of 1000 to 2000 .. Imported two records say ((A,AA,City1)(B,BB,CITY2)) using FName as matching filed (I didnt mapped remote key).. MSS is started so I see the keymapping as A,Remote1 and 1000 and B,Remote1 and 1001 for these two records..
    NNow I created a dummy remote system and added a new field to the main table MatNumber.... I importing the file with (A,AA,City,Mat1) and remote system as dummy where I am mapping MatNumber to Remote Key... By doing so I see three records with one record dublicating as It got imported from new remote system with key value Mat1..
    Can you please guide how to havve only two records by just updating the key value....
    Thanks
    Rajeev
    Edited by: rajeev raj on Jun 22, 2010 10:53 AM

  • * * Procedure needs a way to  perform  update, insert or delete to...

    Hi Gurus,
    I got Assignment & need your help how to write this procedure efficiently.
    ** The procedure needs a way to actually perform the update, insert or delete to bring the reference data up-to-date with the refresh table.**These columns are for internal use and should not be compared to the refresh tables.
    Column 1
    Column 4
    Column 5
    Column 7
    Column 9
    Column 12
    Column 22
    Column 24
    1)     I would list out the columns in the cursors in place of the *. Or better define a record with %ROWTYPE.
    2)     You will need to include a way to look for rows that may be in one table and not the other.
    a.     Insert the rows that exist in the refresh table, but are missing from the reference table.
    b.     Delete the rows that are found in the reference table, but do not appear in the refresh table.
    3)     You also need to provide for handling the expiration date. Our default expiration date is ‘01-JAN-2500’, meaning if the refresh table has a futuristic expiration date or null, then our default expiration date is considered valid. Also this date needs to be added to any new rows created as a result of the refresh, if you leave the EXPIRATION_DATE column out of the insert it should default to the above date.
    4)     I assume that Differences is where you plan to list the actual data values that differ. If you don’t list the whole row I would at least list the primary key, in addition to what columns are different.
    5)     The procedure needs a way to actually perform the update, insert or delete to bring the reference data up-to-date with the refresh table.
    Thanks in advance

    Hi,
    Take a look at merge
    http://www.psoug.org/reference/merge.html
    Keep Smiling
    Bob R

  • How do I update/insert into a target table, rows after date X

    Hi all
    I have a mapping from source table A to target table B. Identical table structure.
    Target table A updates rows and inserts rows daily. Every week I want to synchronize this with table B.
    I have CREATION_DATE and LAST_UPDATE_DATE on both tables. I want to pass in a parameter to this mapping of date X which tells the mapping:
    "if CREATION_DATE is past X then do an insert of this row in B, if LAST_UPDATE_DATE is past X then do an update of this row in B"
    Please can you help me work out how to map this correctly as I am new to OWB.
    Many thanks
    Adi

    Hi,
    You can achieve this by -
    1. Create a control table, say Control_Table, with structure
    Map Name, last_load_date. Populate this table with the mappings that synchronizes your Table B.
    2. Alter mapping, that loads Table B to use the above control table to get all the records from Table A, you have to join Table A and Control_Table with the condition -
    Control_Table.Map_Name = < mapping name>
    AND ( TableA.Creation_Date > Control_Table.last_load_date
    OR TableA.Last_Update_Date > Control_Table.last_load_date )
    3. Then use UPDATE/INSERT on the Table B based on the Keys. This should take care of INSERT ( if not present) / UPDATE (if the row already exists).
    4. Schedule the mapping to run on weekly basis.
    5. You have to maintain the Control_Table to keep changing the values for Last_Load_Date to pick the data since the last time Table B is synchronized.
    HTH
    Mahesh

  • Update/Insert Problem with Oracle Warehouse Builder

    Hello,
    i have update/insert problem with owb.
    Situation: I have a source-table called s_account and a target table called w_account_d. In the target table are already data which was filled trough the source table inserts. Now anyone make changes on data on the target table. This changes should now give further on the source table with an update operation. But exactly here is the problem i can´t map back the data to source because that will create a loop.
    My idea was to set a trigger but i can´t find this component in owb or is anywhere hidden?
    Also i have already seen properties as CDC or conditonal loading in the property inspector of the table, but i have no idea how it works.
    Give it other possibilities to modeling this case? or can anyone me explain how i can implement this eventually with CDC?
    I look forward for your replies :)

    Hi
    thanks for your answer. I follow your suggestion and have set the constraints of both tables into the database directly.Nevertheless it doesn´t work to begin. In the next step i found by right click on a table the listpoint "configure" - I goes to "unique key" --> creation method and set here follow options: Constraint State = ENABLE, Constraint Validation = Validate. That error message that appears before by the deployment disappears yet. Now i start the job to test if the insert/update process works right. Finally it seems to work - but not really.
    My Testscenario
    1. Load the data from source table about the staging area to data warehouse table: Check - it works!
    2. Change one data record in source table
    3. Load the source table with changed data record once again to staging area: Check - it works!
    4. Load new staging area table with the changed data record to data warehouse table: Check it works! BUT, BUT i can not recognize if it is insert or update operation, then under the design window by jobs execution windows is reported "rows selected 98", Rows inserted" is empty and "rows updated" is empty. So i think works not correct, then my opinion if it works correct it should show be "rows updated" 1.
    What can yet now still be wrong or forgotten? Any ideas?
    *By the way think not 98 rows there is not important if you make an update or insert which performance. It is an example table the right tables have million of records.*
    I look forward for your answers :)

  • ORA-14402: updating partition key column would cause a partition change

    Hi,
    When I am trying to execute an update statement where i am tring to update date values emp_det from 11-oct-2010 to 12-nov-2010.
    Oracle throws an error :
    ORA-14402
    updating partition key column would cause a partition change
    I think that this is because emp_det is a partitioning key of a partitioned table.
    Oracle documentation says that
    "UPDATE will fail if you change a value in the column that would move the
    row to a different partition or subpartition, unless you enable row
    movement" .
    alter table t enable row movement;
    I did not understand what is meant by "enable row movement".
    I cannot drop the partitions and recreate it after updating the table and also i don't have proper priviliges for enale row movement syntax
    because of the lack of privileges. How to solve this is issues with out row movement and recreate partition.
    Can this be done by a developer or is there any other way to execute update in this case? its urgent.. pls help..
    thanks in advance..
    By
    Sivaraman
    Edited by: kn_sivaraman on Nov 1, 2010 2:32 AM

    kn_sivaraman wrote:
    I did not understand what is meant by "enable row movement". Each partition in partitioned table is physically separate segment. Assume you have a row that belongs to partition A stored in segment A and you change row's partitioning column to value that belongs to partition B - you have an issue since updated row can't be now stored in segment A anymore. By default such update is not allowed and you get an error. You can enable row movement and Oracle will move row to target partition:
    SQL> CREATE TABLE SALES_LIST(
      2                          SALESMAN_ID NUMBER(5,0),
      3                          SALESMAN_NAME VARCHAR2(30),
      4                          SALES_STATE VARCHAR2(20),
      5                          SALES_AMOUNT NUMBER(10,0),
      6                          SALES_DATE DATE
      7                         )
      8    PARTITION BY LIST(SALES_STATE)
      9    (
    10     PARTITION SALES_WEST     VALUES('California', 'Hawaii'),
    11     PARTITION SALES_EAST     VALUES('New York', 'Virginia', 'Florida'),
    12     PARTITION SALES_CENTRAL  VALUES('Texas', 'Illinois'),
    13     PARTITION SALES_OTHER    VALUES(DEFAULT)
    14    )
    15  /
    Table created.
    SQL> insert
      2    into sales_list
      3    values(
      4           1,
      5           'Sam',
      6           'Texas',
      7           1000,
      8           sysdate
      9          )
    10  /
    1 row created.
    SQL> update sales_list
      2    set  sales_state = 'New York'
      3    where sales_state = 'Texas'
      4  /
    update sales_list
    ERROR at line 1:
    ORA-14402: updating partition key column would cause a partition change
    SQL> alter table sales_list enable row movement
      2  /
    Table altered.
    SQL> update sales_list
      2    set  sales_state = 'New York'
      3    where sales_state = 'Texas'
      4  /
    1 row updated.
    SQL> SY.

  • Update/Insert Duplicate Rows

    Hi I am loading a target table [empty] for the first time. I am using update/insert strategy. however, it's only inserting. not updating inserted rows.

    In a single mapping and on an empty table you can only insert rows. The Insert/Update strategy will update rows if the matching criteria you have used satisfies on an existing set of rows prior to your running the mapping. In other words you cannot expect OWB to update rows which it has inserted in the same statement !...
    You can try Row Based mode and put an order by clause before inserting into the target table and check to see if the update happens.
    Regards
    -AP

  • USB Keyboard - Insert key not working

    I've an HP KU-9963 usb keyboard plugged into a Dell laptop running Windows XP (all the latest updates), where all keys appear to function ok except for the Insert keys. Pressing either Insert key doesn't cause the LED to light and I get no insert action.
    Has anyone ever experienced this with a usb keyboard? Could Microsoft's driver possibly be the culprit?

    Ok, here is the solution I got from HP support. I checked it out in Word and it works:
     If you click the Office Button – click on Word Options – then click on Advanced. Under the Section for Editing options. There is a place to select use the Insert key to control overwright mode.

  • Update primary key/delete and reinsert records

    Hi, I have been told to update some fields. The database is new to me, and now I see the field is the primary key (and it has child tables with that as foreign key). The person who told me isn't reachable until next week...
    ...wasn't a bad idea to update pk's? I see it's possible, deferring constraints...
    update primary key
    Re: Update Primary Key
    ...but it's better/safer the script deletes and later re-insert the records, right?
    Thanks

    Always is better be able to undo any change .
    But ¡, why would you update pk's? it's possible but you colud find few problems like:
    - many levels of foreign keys exists.
    - not validate pk
    Look at:
    Re: Novalidate primary key

  • SQL MERGE trying to duplicate update/insert. The insert/update is not ideal, but the sql merge hangs.

    I am trying to duplicate this update/insert with a sql merge:
    -UPDATE [etag].Energy_Processed
    SET Start_Datetime = estg.Start_Datetime,
    --End_Datetime = estg.End_Datetime,
    --Schedule_MW = estg.Schedule_MW,
    --Active_MW = estg.Active_MW,
    Load_Dt = GETUTCDATE() 
    FROM  [etag].Energy_Stg estg, [etag].[Energy_Processed] ep
    WHERE estg.Tag_Name IN
    SELECT DISTINCT(tproc.Tag_Name) from [etag].[Energy_Processed] eproc
    INNER JOIN [etag].[Tag_Processed] tproc ON tproc.Id = eproc.Tag_Id
    INNER JOIN [etag].[Energy_Stg] estg1 ON estg1.Tag_Name = tproc.Tag_Name
               AND ep.Active_MW = estg.Active_MW
               AND ep.End_Datetime = estg.End_Datetime
              AND ep.Schedule_MW = estg.Schedule_MW 
    INSERT into [etag].[Energy_Processed] (Tag_Id, Start_Datetime, End_Datetime, Schedule_MW, Active_MW, Load_Dt)
    SELECT tproc.Id, estg.Start_Datetime, estg.End_Datetime, Schedule_MW, Active_MW, GETUTCDATE()  FROM [etag].[Energy_Stg] estg
    INNER JOIN [etag].[Tag_Processed] tproc ON tproc.Tag_Name = estg.Tag_Name
    WHERE estg.Id BETWEEN @minEId AND @maxEId AND
    estg.Tag_Name NOT IN (
    SELECT DISTINCT (tproc.Tag_Name) from [etag].[Energy_Processed] eproc
    INNER JOIN [etag].[Tag_Processed] tproc ON tproc.Id = eproc.Tag_Id
    INNER JOIN [etag].[Energy_Stg] estg1 ON estg1.Tag_Name = tproc.Tag_Name
    SQL MERGE:
    MERGE [Forecast_Data_Repository].[etag].[Energy_Archive] enArch
    USING 
    (SELECT ep.Tag_Id, ep.Start_Datetime, ep.End_Datetime, ep.Schedule_MW, ep.Active_MW, ep.Load_Dt 
    FROM  [etag].[Energy_Stg] estg, [etag].[Energy_Processed] ep
    WHERE estg.Tag_Name IN
    SELECT DISTINCT(tproc.Tag_Name) from [etag].[Energy_Processed] eproc
    INNER JOIN [etag].[Tag_Processed] tproc ON tproc.Id = eproc.Tag_Id
    INNER JOIN [etag].[Energy_Stg] estg1 ON estg1.Tag_Name = tproc.Tag_Name
    ) AS sourceEP
    ON EXISTS(SELECT sourceEP.Tag_Id)
    WHEN MATCHED THEN
    UPDATE
    SET Tag_Id = sourceEP.Tag_Id,
    Start_DateTime = sourceEP.Start_Datetime,
    End_Datetime = sourceEP.End_Datetime,
    Schedule_MW = sourceEP.Schedule_MW,
    Load_dt = GETUTCDATE()
    WHEN NOT MATCHED BY TARGET THEN
    INSERT (Tag_Id, Start_Datetime, End_Datetime, Schedule_MW, Active_MW, Load_dt)
    VALUES (sourceEP.Tag_Id, sourceEP.Start_Datetime, sourceEP.End_Datetime, sourceEP.Schedule_MW,
    sourceEP.Active_MW, GETUTCDATE())
    OUTPUT
    $action,
    INSERTED.Tag_Id
    --UPDATED.Tag_Name
    INTO @MergeOutput;
    Greg Hanson

    This bit
        ON EXISTS(SELECT sourceEP.Tag_Id)
    Looks wrong. Sould be something like:
       ON sourceEP.Tag_Id = enArch.Tag_Id
    And don't update the matching columns in the UPDATE part, as they already match.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Incremental Loading: Update: Use for Matching

    I'm using
    Oracle DB 9.2 with OWB version 9.0.3.35.
    In doing an update/insert mappping.
    When I enter the Attribute Properties of the Target Table for the Attribute I want to Update, the "Update: Use for matching" is set to NO and its grey out. Meaning I can't change it to YES to validate the mapping.
    Any suggestions on what's causing this and ideas on how to fix.

    Check if All Constraints are enabled for the target itself. If it is, change it for No Constraints and you should be able to change each column propertie. It worked for me... But do you need to keep the constraints?

  • Error in updating/inserting task in database

    When I pass in a runtimeFault Code, Detail and Summary into Flexstring1,2,3 I am getting this runtime error :
    Error in updating/inserting task in database. SQL Exception while updating/inserting task into the database. Check the error stack and fix the cause of the error. Contact oracle support if error is not fixable.
    Where can I find the error stack?
    Pete

    turn the following loggers from info to debug level (bpel console/manage domain/ tab logging)
    default.collaxa.cube.ws and
    default.oracle.services
    given you are using a developer isntall, you should see the stack a dos box
    if you are using an application server mid tier cou can find them in $AS_HOME/opmn/logs/OraOc4J_BPELxxxx.log
    hth clemens

Maybe you are looking for

  • Error status on validating PO Item tcode ME22N is always displayed at last

    Hi Gurus, I am using the method  IF_EX_ME_PROCESS_PO_CUST~CHECK to validate a line item. I have say 20 line items and the 5th line item has an error on validating. I am able to display the correct error message with correct line item number, however

  • Problem with mp3

    Hi, im able to play mp3 songs in JMStudio, but can't transmit any MP3 songs. With JMStudio, in order to transmit, i'd have to configure the encoding with Big Endian (instead of Little Endian); so it threw the error of Failed to realize: cannot handle

  • IWeb compatibility with IE8/Firefox

    Hi all, first time posting...just found out about these forums recently & they have been helpful already so I am hoping some of you can shed some light on a technical issue I am having. Just launched my site recently & have been having issues with ge

  • Several keys in a row fail repeatedly on keyboard on G3 iBook

    OK, here's the situation: A couple months ago the "9", "O", "L", and period key on my G3 dual USB 12" iBook stopped working. A little search in here and across the Internet found the suggestion to try reseating the keyboard cable. I did so. The keys

  • Setting A Default Window View

    10.4.8 Is there a way to set a default so that varied windows can automatically open in list view rather than icon view which is the way they are opening now? I have already gone through many windows and set them using the View Options command - but