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

How to use Update cursor when deleting the row


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
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
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
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
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 All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Can BPXBATCH update TAPE file COBOL Programming 3
No new posts Inserting into table while open selec... DB2 1
No new posts Deleting a Tape file JCL & VSAM 14
No new posts CA7 deleting files in steps after job... CA Products 4
No new posts Read a flat file and update DB2 table JCL & VSAM 2
Search our Forums:


Back to Top