View previous topic :: View next topic |
Author |
Message |
sri50131 Beginner
Joined: 07 Oct 2004 Posts: 38 Topics: 15
|
Posted: Tue Oct 19, 2004 1:59 pm Post subject: SQLCODE -510 Issue |
|
|
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 |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Tue Oct 19, 2004 2:52 pm Post subject: |
|
|
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 |
|
 |
sri50131 Beginner
Joined: 07 Oct 2004 Posts: 38 Topics: 15
|
Posted: Tue Oct 19, 2004 3:08 pm Post subject: |
|
|
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 |
|
 |
sri50131 Beginner
Joined: 07 Oct 2004 Posts: 38 Topics: 15
|
Posted: Tue Oct 19, 2004 4:24 pm Post subject: |
|
|
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 |
|
 |
|
|