dbTalk Databases Forums  

is there any quick way to get affected row count from every branch ofMERGE?

comp.databases.ibm-db2 comp.databases.ibm-db2


Discuss is there any quick way to get affected row count from every branch ofMERGE? in the comp.databases.ibm-db2 forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Hardy
 
Posts: n/a

Default is there any quick way to get affected row count from every branch ofMERGE? - 08-09-2010 , 02:18 PM






if I'm using the MERGE and want to return how many rows are updated
and how many rows are inserted, the way of get-diagnotics/select-
changed-table doesn't work. A direct way is just to split the
statement to update and insert, return the affected count. or just
use merge, and use the predicate to test the affected count.

is there any good way to do that? or Merge just not a good choice
here?

Thanks.

Reply With Quote
  #2  
Old   
Serge Rielau
 
Posts: n/a

Default Re: is there any quick way to get affected row count from every branchof MERGE? - 08-10-2010 , 01:15 AM






On 8/10/2010 3:18 AM, Hardy wrote:
Quote:
if I'm using the MERGE and want to return how many rows are updated
and how many rows are inserted, the way of get-diagnotics/select-
changed-table doesn't work. A direct way is just to split the
statement to update and insert, return the affected count. or just
use merge, and use the predicate to test the affected count.

is there any good way to do that? or Merge just not a good choice
here?

Thanks.
Are you saying you want the "ratio" of INSERT vs UPDATE vs DELETE?
I can't think of any easy way. That's where SELECT FROM MERGE would come
in handy....some day,...


--
Serge Rielau
SQL Architect DB2 for LUW
IBM Toronto Lab

Reply With Quote
  #3  
Old   
Hardy
 
Posts: n/a

Default Re: is there any quick way to get affected row count from everybranch of MERGE? - 08-10-2010 , 07:56 AM



On Aug 10, 1:15*am, Serge Rielau <srie... (AT) ca (DOT) ibm.com> wrote:
Quote:
On 8/10/2010 3:18 AM, Hardy wrote:> if I'm using the MERGE and want to return how many rows are updated
and how many rows are inserted, the way of get-diagnotics/select-
changed-table doesn't work. *A direct way is just to split the
statement to update and insert, return the affected count. *or just
use merge, and use the predicate to test the affected count.

is there any good way to do that? or Merge just not a good choice
here?

Thanks.

Are you saying you want the "ratio" of INSERT vs UPDATE vs DELETE?
I can't think of any easy way. That's where SELECT FROM MERGE would come
in handy....some day,...

--
Serge Rielau
SQL Architect DB2 for LUW
IBM Toronto Lab
Thank you, Serge

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.