If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > SQLCODE -501 Error Code

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-20-04, 00:52
sr07066 sr07066 is offline
Registered User
 
Join Date: Oct 2004
Posts: 1
SQLCODE -501 Error Code

Hello,

I have 2 cursors in my program that are declared with ' FOR UPDATE OF' option. Both these cursors update the same column of a particular 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(CL-COVC.D-END) - 1 DAY
WHERE CURRENT OF CURSOR2

Cursor3 update:
EXEC SQL
UPDATE COVC B
SET D_END = DATE(CL-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.

Also, I open, fetch and close each cursor seperately.

Can someone tell me what am I doing wrong?

Thanks.
Reply With Quote
  #2 (permalink)  
Old 10-20-04, 11:10
urquel urquel is offline
Registered User
 
Join Date: Aug 2004
Posts: 330
Is COVC a view? If so, is it updateable?

Last edited by urquel; 10-20-04 at 11:14.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On