MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQLCODE -510 Issue

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
sri50131
Beginner


Joined: 07 Oct 2004
Posts: 38
Topics: 15

PostPosted: Tue Oct 19, 2004 1:59 pm    Post subject: SQLCODE -510 Issue Reply with quote

Hello,

I have 2 cursors in my program that are declared with ' FOR UPDATE OF' option. Both these cursors update the same column of aparticular table on different conditions. I am getting a -510 (-510 THE TABLE DESIGNATED BY THE CURSOR OF THE UPDATE OR DELETE STATEMENT CANNOT BE MODIFIED) on the 2nd cusor update statement.

Here is the pseudo code that I have in my program for update:

Cursor2 update:

EXEC SQL
UPDATE COVC B
SET D_END = DATE(:DCL-COVC.D-END) - 1 DAY
WHERE CURRENT OF CURSOR2

I am not getting any error here:

Cursor3 update:
EXEC SQL
UPDATE COVC B
SET D_END = DATE(:DCL-COVC.D-END) - 1 DAY
WHERE CURRENT OF CURSOR3

Explanation of -510: The application program attempted to execute an UPDATE or DELETE WHERE CURRENT OF cursor statement against a table or view that cannot be updated or deleted. This can occur for a delete from a
read-only view or for an update in which the cursor was not defined with
the FOR UPDATE clause.

Can anyone tell what I am missing.

Thanks.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Tue Oct 19, 2004 2:52 pm    Post subject: Reply with quote

Sri51031,

Was your CURSOR2 defined for update of D_END? If you already done that try binding the program with using the DEGREE(1) BIND option.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sri50131
Beginner


Joined: 07 Oct 2004
Posts: 38
Topics: 15

PostPosted: Tue Oct 19, 2004 3:08 pm    Post subject: Reply with quote

Kolusu,

You are right, the cursor2 and cursor3 are defined for update of D_END. What I do not understand is that I do not open all my cursors at the same time, I open, fecth and close one cursor at a time. So, logically, I do not have an ambigious situation where two cursors are opened to update the same column of the same table. I never have bound my progam with DEGREE(1) BIND OPTION. Can you tell or guide me to the site that can explain me how to bind my program with the option you mentioned.

Thanks.
Back to top
View user's profile Send private message
sri50131
Beginner


Joined: 07 Oct 2004
Posts: 38
Topics: 15

PostPosted: Tue Oct 19, 2004 4:24 pm    Post subject: Reply with quote

Kolusu,

I bound my program with both DEGREE (ANY) and DEGREE (1) options - still getting the same -510 SQLCODE on the second update.

This is how my bind card looks
DSN SYSTEM(DBT0 )
BIND PACKAGE(BTS_TESTDB2)
MEMBER(KJP06010)
OWNER(UGISDB2T)
QUALIFIER(TESTDB2)
CURRENTDATA(NO)
DEGREE (1)
ISO(CS)
VALIDATE(BIND)
EXPLAIN(YES)

Any suggestions.

Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group