[resolved] Insert & Update with tMap?

One Star

[resolved] Insert & Update with tMap?

Hi,
I am wondering how should I create the mappings & lookup if I want to insert data into the database if the primary key value doesn't exists and update the existing data in the database if any data is changed.
My input is data from MySQL database and Output is an Oracle database. I have a simple mapping such as:
tMySqlInput --> Main --> tMap --> Main --> tOracleOutput (with Action on Data = Insert)
Based on the above mapping, how can I create mappings & lookup if there is new data from MySQL, data will be inserted into Oracle and if there is a data changed from MySQL, an update should be executed in Oracle? Should I create a tOracleInput as a lookup?
Please any help is really appreciated!!
Thanks!

Accepted Solutions
One Star

Re: [resolved] Insert & Update with tMap?

Hi Shong,
Thanks! It works great; however, can you please explain the difference between "insert or update" & "update or insert" items in action on data list? Is the difference on the sequence which action is triggered first?
Thanks again

All Replies
Community Manager

Re: [resolved] Insert & Update with tMap?

Hello
how should I create the mappings & lookup if I want to insert data into the database if the primary key value doesn't exists and update the existing data in the database if any data is changed.

Only select 'insert or update' item on action on data list, check 'key' box of primary key column on schema of tOracleOutput, don't need do any lookup on tMap.
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Insert & Update with tMap?

Hi Shong,
Thanks! It works great; however, can you please explain the difference between "insert or update" & "update or insert" items in action on data list? Is the difference on the sequence which action is triggered first?
Thanks again
Community Manager

Re: [resolved] Insert & Update with tMap?

Hello
Is the difference on the sequence which action is triggered first?

We can say that it get the same result between "insert or update" & "update or insert", the only difference is which action is triggered first as you said.
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Six Stars

Re: [resolved] Insert & Update with tMap?

If you expect more data to be inserted than data to be updated, use Insert or Update and viceversa.
One Star

Re: [resolved] Insert & Update with tMap?

it doesn't work for me Smiley Sad!!!!
Community Manager

Re: [resolved] Insert & Update with tMap?

Hello
To imanouch87, please create a new topic and describe your problem.
Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: [resolved] Insert & Update with tMap?

Can u please provide any screen shots for this.....? which can help us too good.