Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2004
    Posts
    1

    Unanswered: 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.

  2. #2
    Join Date
    Aug 2004
    Posts
    330
    Is COVC a view? If so, is it updateable?
    Last edited by urquel; 10-20-04 at 12:14.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •