ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » IIB9: ESQL, ROWCOUNT ON DELETE & UPDATE

Post new topic  Reply to topic
 IIB9: ESQL, ROWCOUNT ON DELETE & UPDATE « View previous topic :: View next topic » 
Author Message
akil
PostPosted: Wed Aug 13, 2014 10:56 pm    Post subject: IIB9: ESQL, ROWCOUNT ON DELETE & UPDATE Reply with quote

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
View user's profile Send private message Visit poster's website
Vitor
PostPosted: Thu Aug 14, 2014 5:08 am    Post subject: Reply with quote

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
View user's profile Send private message
akil
PostPosted: Thu Aug 14, 2014 10:39 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » IIB9: ESQL, ROWCOUNT ON DELETE & UPDATE
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.