|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
IIB9: ESQL, ROWCOUNT ON DELETE & UPDATE |
« View previous topic :: View next topic » |
Author |
Message
|
akil |
Posted: Wed Aug 13, 2014 10:56 pm Post subject: IIB9: ESQL, ROWCOUNT ON DELETE & UPDATE |
|
|
 Partisan
Joined: 27 May 2014 Posts: 338 Location: Mumbai
|
Hi
Is it possible to figure out the number of rows that were updated or deleted for a database statement ?
Code: |
UPDATE Database.RCDSSYSPARAMS SET VALUE = VALUE + 1 WHERE MNEMONIC = 'HO_04_BATCHID';
|
If the number of rows updated is anything other than 1 , it indicates an error (for my application), and the flow needs to throw an exception. I am unable to figure out how to do this. _________________ Regards |
|
Back to top |
|
 |
Vitor |
Posted: Thu Aug 14, 2014 5:08 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Why not do:
Code: |
SELECT VALUE FROM Database.RCDSSYSPARMS WHERE MNEMONIC = 'HO_04_BAYCHID'
|
If you get more than 1 row back, throw an exception.
A more obvious (and IMHO better) solution is to add a constraint to the database table so MNEMONIC is always unique. If there's only supposed to be 1 row with that value, enforce it where the row lives.
You could also put the update in a PASSTHRU function (not the statement, the function) and see if the row count is returned. Not tried it, don't know if it works, still think you should have a database constraint. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
akil |
Posted: Thu Aug 14, 2014 10:39 am Post subject: |
|
|
 Partisan
Joined: 27 May 2014 Posts: 338 Location: Mumbai
|
The constraint will help prevent a duplicate , but it won't help if zero rows get updated ... Which could be because of a data error or in case the esql code is buggy .. In oracle pl/SQL folks usually check for row count post an update and raise an exception , was wondering how to do that in esql ..
Will try PASSTHRU, _________________ Regards |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|