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

receiving an SQLCODE of -510


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kishoreEC

New User


Joined: 17 Aug 2007
Posts: 2
Location: HYD

PostPosted: Fri Aug 17, 2007 12:38 pm
Reply with quote

Hi,

My basic requirement is i want to have the count of number of records deleted from the table.

Currently,there are three tables: Tab1 ,Tab2 ,Tab3

Once a record in Tab1 is deleted,the record in TAb2 is also deleted.

Insert the data retrieved from Tab1 and Tab2 into Tab3 and delete the same data retrieved from Tab1 and Tab2.

Hence,i used a cursor which is below:

EXEC SQL
DECLARE DEL_MSGLOG_CUR CURSOR FOR
SELECT B.GML_IRN_TS FROM
GMS_MSG_LOG B , GMS_MSG_RESULTS C
WHERE B.GML_IRN_TS = C.GMR_IRN_TS
AND B.GML_IRN_TS < :WS-OLD-TIME
AND (B.GML_SQL_CDE > 0 OR
B.GML_RLS_VRFY_USE = 'N' OR
(B.GML_RLS_VRFY_USE = 'Y' AND
C.GMR_REPLY_RV_TS > :WS-INIT-TS) OR
(B.GML_RLS_VRFY_USE = 'Y' AND
C.GMR_SCAN_STA IN ('0','7','8','100') AND
C.GMR_REPLY_RV_TS = :WS-INIT-TS) OR
B.GML_SEND_APPL_ID LIKE 'HLTH%')
FOR UPDATE
END-EXEC.

the query i used for deleting is :

DELETE FROM GMS_MSG_LOG
WHERE CURRENT OF DEL_MSGLOG_CUR

and i am receving an error code of -510.Can u assist me i this rerard.
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Fri Aug 17, 2007 2:28 pm
Reply with quote

I know it's a dumb question, but what did you learn from looking up the -510 error?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Fri Aug 17, 2007 2:32 pm
Reply with quote

This link is provided by IBM for those who just can't be bothered to access manuals.

In addition, for something as simple as a SQLCODE definition, you can download ABENDASSIT from this website (ibmmainframes), which is free and provides error code descriptions for db2, vsam, cobol, ims, etc........

since it is obvious that you do not bother to read the documentation, you would be confused by the description of a -510.

In short: you can not update, insert or delete from a CURSOR that returns read-only views. The definition of a read only view can be found in the next to the last post of this thread .
Back to top
View user's profile Send private message
kishoreEC

New User


Joined: 17 Aug 2007
Posts: 2
Location: HYD

PostPosted: Fri Aug 17, 2007 2:39 pm
Reply with quote

I read the manuals,but overlooked the real meaning of the explaination.

What really confused me is that for deletion,previously,they used a direct 'DELETE' query instead of using Cursor.so,i was wondering why can;t it be doe this way.

I am sorry and thank you all for the assistance...
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Receiving RC 5 when executing REXX pr... CLIST & REXX 3
No new posts SQLCODE = -122 while using the scalar... DB2 4
No new posts SQLCODE = -16002 when using XMLEXISTS DB2 1
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
No new posts SQLCODE=-204 SQLSTATE=42704 DB2 4
Search our Forums:

Back to Top