I got in situation where i need to do batch update since updating one by one… it’s taking very long period time to complement( almost 80k -100k) records. At beginning, the reason for not doing batch update because if any records failed to update in the table then for that particular records we need to send am email alter to database team.
Now, we would like to do batch update and for any failure update we just need send an email that few records failed to update ( no email with record value)
Now, the problem is, what I read from Software AG documentation that in batch update if all records updated with success then result output parameter will return positive integer value and if any record failed then negative …
But when I am doing POC for this. I am getting only negative value (-2) in both the cases.
Is anyone faced this situation and he/she resolved this?
Hi Tanveer,
I recently noticed this as well. It is a bug. You could create a SI with SAG support.
When you say, ‘if any record failed to update’, it can be of two types
Update did not happen as no record matched - no error - still success
Update failed due to constraint error, transient error etc., - throws error
To overcome this right now, you can wrap ‘batch update adapter service’ in a try catch, and on successful completion, the execution wouldn’t reach catch.
Thanks a lot putting some light on this, I was talking about the first point you have mentioned. Update didn’t happen when update condition is not found.
In every case, batchUpdate adapter result output returns ‘-2’ only, that is making us very difficult how we are going to improve performance. BatchUpdate is one option but its not working. We have check some other options.
It would be great if some alternative could be found.
Hi Tanveer,
I don’t think this has anything to do with performance. As I mentioned, if you wrap the ‘update adapter service call’ specifically inside a try/catch, you could differentiate if the update execution is success or failure. Only thing you wouldn’t be able to find is, how many records got affected in that execution. Create ticket with SAG support.
Our requirement was to get the exact count of update in batch. That’s we were not getting because it’s returning ‘-2’ in every-case… For failure scenario I am using try/catch block to handle the any kind of exception.
Since exact count of update is needed so I have decided to write Java Service for batch update and found that this is limitation of Oracle and it does not support of getting the count in case of batch update using PreparedStatement interface. So I get the idea that SAG has implemented jdbc batch adapter service using PreparedStatement interface only.
Now, we have pushed the target team for not sending update count.