cancel
Showing results for 
Search instead for 
Did you mean: 

Working with JDBC Adapter

Former Member
0 Kudos

I have XML


<persons>
  <person>
  </person>
  ....
</persons>

I need to perform UPDATE or INSERT for each <person> in one transacion.

Will this SQL XML work?

<STATEMENT> 
  <TABLE_NAME action="UPDATE_INSERT">
     <table>realDbTableName</table>   
     ... 
  </TABLE_NAME>
  <TABLE_NAME action="UPDATE_INSERT">
     <table>realDbTableName</table>  
     ...  
 </TABLE_NAME>
  ... 
</STATEMENT>

Is it posible to prevent UPDATE if the data in <parson> are the same like in DB TABLE?

Accepted Solutions (0)

Answers (2)

Answers (2)

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

use insert if you don't want to update in case the record already exists in the db table

Regards,

michal

Former Member
0 Kudos

I want UPDATE <b>new</b> data but I don't want UPDATE the data that are the same. It is because we have a historyu table and TRIGGER updates that table by each UPDATE/INSERT

MichalKrawczyk
Active Contributor
0 Kudos

hi,

>>>I want UPDATE new data

so you just want to insert new data and not update...

I'm a bit confused

Regards,

michal

Former Member
0 Kudos

Ok. I meant that I want update only changed data.

I case of INSERT I will have a duplicated data.

My system produces all records and I have to determine which I have to UPDATE/INSERT or admit.

Former Member
0 Kudos

Hi Sergey,

No it won't. You do not need to specify the table name on each and every lineitem. You just need to specify on the first entry then it will populate the columns accordingly.

If the data is same then the JDBC adapter will not update the table column thus no Insert task will be performed. Thats the benefit of using the UPDATE_INSERT action instead of just the Insert.

Cheers,

Ranjan

MichalKrawczyk
Active Contributor
0 Kudos

Hi Ranjan,

why wouldn't the UPDATE_INSERT

update the same data ?

Regards,

michal

Former Member
0 Kudos

I meant use UPDATE only and not UPDATE_INSERT. I think how the adapter works is that when you use UPDATE_INSERT, only one of the action will be executed either UPDATE OR INSERT. In the same of the same data if you use the UDATE_INSERT, even if its not going to update the data, it will still insert the same value. So, I think you will need to use only UPDATE so that ONLY the changed data will be populated into the table.

This link will be helpful for you.

http://help.sap.com/saphelp_nw04/helpdata/en/22/b4d13b633f7748b4d34f3191529946/frameset.htm

Cheers,

Ranjan