Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Number of deleted rows

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Number of deleted rows
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts Row-Numbers of distinct rows? Auryn DB2 1 Thu Oct 20, 2016 4:38 pm
No new posts Sequence number add in SORT pshongal SYNCSORT 3 Fri Sep 02, 2016 3:32 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us