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
 
How to use Update cursor when deleting the row

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
emonmisra

New User


Joined: 10 Jul 2006
Posts: 7
Location: Bangalore

PostPosted: Thu Jan 03, 2008 11:01 am    Post subject: How to use Update cursor when deleting the row
Reply with quote

The queries are as follows:

Declaring the cursor
Declare C-SEL10 Cursor FOR

SELECT B.RBVOR_VORGANG, C.RBNEW_ACCNT_UID
FROM RBCBAT A,
RBVORT B,
RBNEWT C
WHERE B.RBVOR_VORGANG = A.RBCBA_VORGANG
AND B.RBVOR_MANDINT = A.RBCBA_MANDINT
AND B.RBVOR_SELDAT = A.RBCBA_SELDAT
AND A.RBCBA_UID = C.RBNEW_ACCNT_UID
FOR UPDATE OF C.RBNEW_ACCNT_UID


then using the above cursor delete after fetch

DELETE FROM C
WHERE CURRENT OF C-SEL10

In this case in binding I am getting the SQLCODE = -510

Please suggest how to proceed
Back to top
View user's profile Send private message

rajaherein

New User


Joined: 11 Jan 2007
Posts: 23
Location: chennai

PostPosted: Thu Jan 03, 2008 2:12 pm    Post subject: Reply to: How to use Update cursor when deleting the row
Reply with quote

Are the Tables declared are native or Remote. If the tables are remote, then -510 occurs during Bind.
Back to top
View user's profile Send private message
lalitsharma_77

New User


Joined: 29 Nov 2007
Posts: 10
Location: Pune

PostPosted: Thu Jan 03, 2008 6:08 pm    Post subject: Reply to: How to use Update cursor when deleting the row
Reply with quote

Hi,

Cursor Update cannot be used if your SELECT statement consist of any one of the follwoing:

ORDER BY
GROUP BY
DISTINCT
JOIN
UNION
AGGREGATE FUNCTIONS


Please correct me if I am wrong.
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 Need Guidance regarding UPDATE query Poha Eater DB2 3 Mon Feb 12, 2018 11:35 pm
No new posts Conversion of DLI update Jobs as BMP ... Gopinath Shanmugam IMS DB/DC 3 Wed Dec 20, 2017 12:02 pm
No new posts TBSARG - Deleting the search criteria... ISPFHerc TSO/ISPF 6 Thu Dec 14, 2017 8:18 am
No new posts -502 Error - Cursor already open anand jeyapaul DB2 7 Sun Oct 29, 2017 4:22 am
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm

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