Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Conditional highlighting of rows in I... packerm CLIST & REXX 2 Thu Sep 21, 2017 6:50 pm
No new posts column with count of rows within dist... ronald wouterson DB2 4 Sun Sep 17, 2017 9:48 pm
No new posts Convert rows and column into JSON for... Dinesh Manivannan DB2 2 Sun Sep 03, 2017 6:50 pm
No new posts Profile changed to NUMBER ON STD (fro... Martylin TSO/ISPF 1 Thu Aug 03, 2017 9:14 am
No new posts compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us