IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Number of deleted rows


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
pjnithin

Active User


Joined: 22 Dec 2005
Posts: 116

PostPosted: Thu Dec 06, 2007 11:02 am
Reply with quote

Is there any explicit DB2 command to get the number of rows deleted from a particular table. I don't want to do a select query before running the delete query to get the number of rows that will be deleted.
Back to top
View user's profile Send private message
VinayCM

New User


Joined: 06 Nov 2007
Posts: 36
Location: Bengaluru

PostPosted: Thu Dec 06, 2007 11:13 am
Reply with quote

Hi,
I think it's stored in SQLERRD if you are in a COBOL-DB2 program and you included SQLCA. Just check it, I'm not sure.
Back to top
View user's profile Send private message
Srihari Gonugunta

Active User


Joined: 14 Sep 2007
Posts: 295
Location: Singapore

PostPosted: Thu Dec 06, 2007 12:02 pm
Reply with quote

The following options can be used for this purpose
1) DELETE FROM EMP WHERE JOB = ’OPERATOR’
If the DELETE is successful, SQLERRD(3) in the SQLCA contains the number of deleted rows.

2) SELECT COUNT(*) INTO :CNT FROM OLD TABLE (DELETE FROM EMP WHERE JOB = ’OPERATOR’);
Select and Delete combined in this case.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Substring number between 2 characters... DFSORT/ICETOOL 2
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Increase the number of columns in the... IBM Tools 3
Search our Forums:

Back to Top