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 compare 2 rows within the same file ram_vizag SYNCSORT 7 Wed Jun 14, 2017 12:34 am
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm
No new posts Edit large number of datasets (QSAM) zh_lad TSO/ISPF 3 Tue Apr 04, 2017 6:08 pm
No new posts how to mask the phone number kumarinfy DB2 4 Mon Apr 03, 2017 5:23 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm


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