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 » How to check the rows updated

Post new topic  Reply to topic
 How to check the rows updated « View previous topic :: View next topic » 
Author Message
nelson
PostPosted: Thu Aug 27, 2015 4:42 am    Post subject: How to check the rows updated Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

Hi all,

How can I check if a row or rows were updated from ESQL using the UPDATE statement or the PASSTROUGH statement?

Thanks in advance.
Back to top
View user's profile Send private message
maurito
PostPosted: Thu Aug 27, 2015 4:58 am    Post subject: Re: How to check the rows updated Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

nelson wrote:
Hi all,

How can I check if a row or rows were updated from ESQL using the UPDATE statement or the PASSTROUGH statement?

Thanks in advance.


do you want to know if the database records that meet the WHERE condition were updated OR if any records were updated ? it is not clear from your question.

If it is the former, then you need to inspect the rows and verify they contain the values you expect.
For the latter, you can do a SELECT COUNT(*) with the same WHERE clause as the update. If the count is 0 then skip the UPDATE
Back to top
View user's profile Send private message
nelson
PostPosted: Thu Aug 27, 2015 5:10 am    Post subject: Re: How to check the rows updated Reply with quote

Partisan

Joined: 02 Oct 2012
Posts: 313

maurito wrote:
nelson wrote:
Hi all,

How can I check if a row or rows were updated from ESQL using the UPDATE statement or the PASSTROUGH statement?

Thanks in advance.


do you want to know if the database records that meet the WHERE condition were updated OR if any records were updated ? it is not clear from your question.

If it is the former, then you need to inspect the rows and verify they contain the values you expect.
For the latter, you can do a SELECT COUNT(*) with the same WHERE clause as the update. If the count is 0 then skip the UPDATE


Thanks for your reply. Good idea...
Back to top
View user's profile Send private message
maurito
PostPosted: Thu Aug 27, 2015 5:39 am    Post subject: Re: How to check the rows updated Reply with quote

Partisan

Joined: 17 Apr 2014
Posts: 358

nelson wrote:
maurito wrote:
nelson wrote:
Hi all,

How can I check if a row or rows were updated from ESQL using the UPDATE statement or the PASSTROUGH statement?

Thanks in advance.


do you want to know if the database records that meet the WHERE condition were updated OR if any records were updated ? it is not clear from your question.

If it is the former, then you need to inspect the rows and verify they contain the values you expect.
For the latter, you can do a SELECT COUNT(*) with the same WHERE clause as the update. If the count is 0 then skip the UPDATE


Thanks for your reply. Good idea...


you can also write an Oracle SP ( I guess you are using Oracle from a previous post of yours ) to return the number of records updated, something like:
Code:

declare
  i number;
begin
  update employees set payrise = '20%' where name like '%nelson';
  i := sql%rowcount;
end;


and return the value of i
Back to top
View user's profile Send private message
mqjeff
PostPosted: Thu Aug 27, 2015 5:54 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Are you trying to find out how many rows will be updated?

Or how many rows were updated?
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to check the rows updated
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.