Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

receiving an SQLCODE of -510

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: receiving an SQLCODE of -510
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: 3158
Location: Tucson AZ

PostPosted: Fri Aug 17, 2007 2:28 pm    Post subject:
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: 6967
Location: porcelain throne

PostPosted: Fri Aug 17, 2007 2:32 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 SQL Error: SQLCODE=-440, SQLSTATE... kishpra DB2 1 Sat Feb 18, 2017 2:31 am
No new posts CICS Service requester-receiving 'Hos... urampilla CICS 4 Sat Mar 05, 2016 1:25 am
No new posts SQLCODE-000000080N priya91 DB2 1 Mon Feb 01, 2016 4:35 pm
No new posts Need to understand SQLCODE = 12 rohanthengal DB2 3 Thu Nov 05, 2015 11:22 am
No new posts SQLCODE -922 in Batch-Cics program tr... kishpra CICS 2 Thu Sep 10, 2015 12:36 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us