|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to check the rows updated |
« View previous topic :: View next topic » |
Author |
Message
|
nelson |
Posted: Thu Aug 27, 2015 4:42 am Post subject: How to check the rows updated |
|
|
 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 |
|
 |
maurito |
Posted: Thu Aug 27, 2015 4:58 am Post subject: Re: How to check the rows updated |
|
|
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 |
|
 |
nelson |
Posted: Thu Aug 27, 2015 5:10 am Post subject: Re: How to check the rows updated |
|
|
 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 |
|
 |
maurito |
Posted: Thu Aug 27, 2015 5:39 am Post subject: Re: How to check the rows updated |
|
|
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 |
|
 |
mqjeff |
Posted: Thu Aug 27, 2015 5:54 am Post subject: |
|
|
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 |
|
 |
|
|
 |
|
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
|
|
|
|