Error (-510) - for Update of (cursor )
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> Database

#1: Error (-510) - for Update of (cursor ) Author: mainframemouli PostPosted: Mon Aug 07, 2006 3:29 am
    —
I searched this forum and i found a simillar issue , but the problem with that issue is usage of multiple cursor , i am using a cursor to fetch from the table matching a specific criteria and updating the table where the cursor is currently pointing to.

There is a -510 sql code for the cursor program.

Code:

SELECT OM.ORDNUM,                         
       OM.ORDTYP,                         
       OM.PROCESSCOMPIND1,                 
       OM.PROCESSCOMPIND2,                 
       OC.ORDNUM,                         
       OC.MSGNUM                           
FROM  A0.OCORDHV OM,A0.OMSGV OC           
WHERE OM.ORDNUM = OC.ORDNUM               
AND   OC.MSGNUM = :WS-MSGNUM-VAL           
AND   OM.ORDTYP = :WS-ORDTYP-VAL           
AND   OM.PROCESSCOMPIND1 = :WS-COMPIND1-VAL
AND   OM.PROCESSCOMPIND2 = :WS-COMPIND2-VAL
FOR UPDATE OF PROCESSDTE7,PROCESSCOMPIND2 
END-EXEC.                                 


The Update statement is as follows

Code:

EXEC SQL                                   
  UPDATE A0.OCORDHV                       
    SET PROCESSCOMPIND2 = :WS-COMPIND1-VAL,
        PROCESSDTE7 = :WS-CREATEDTE-OM     
  WHERE CURRENT OF ABC_CURS               
END-EXEC                                   


Is that a problem with the View or the application logic.

#2:  Author: CZerfas PostPosted: Mon Aug 07, 2006 3:42 am
    —
Hello Mainframemouli,

the cursor you have defined is a not-updateable-cursor, since it contains a join.

The criteria for beeing an updateable cursor is, that your cursor has to use only the base tables, i.e. there have to be no intermediate workfiles build by DB2. These workfiles are built for joins, index-ORing and sorts. Only a pretty limited number of cursors could therefor be used for positioned updating.

regards
Christian

#3:  Author: shekar123Location: Bangalore India PostPosted: Mon Aug 07, 2006 3:44 am
    —
mainframemouli,

Can you make info and try to debug:

Programmer Response: The requested UPDATE or DELETE cannot be performed.

1.For a remote table, modify the DECLARE CURSOR andthen rebind the PLAN.
2.For a cursor that uses parallelism, disable parallelism for the query by using the DEGREE(1) BIND option for
static SQL or by setting the CURRENT DEGREE special register to '1' for dynamic SQL.
3.For an ambiguous cursor in an application bound CURRENTDATA(NO), either make the cursor unambiguous (declare it FOR UPDATE OF), or rebind the application CURRENTDATA(YES).

#4:  Author: mainframemouli PostPosted: Mon Aug 07, 2006 4:45 am
    —
Thanks CZerfas.

Shekar,
What CZerfas told is true that a we cannot update a intermedaite table. Only base tables can be updated.

Do you think even then the solutions you suggested can work fine?please suggest me if its possible still.



MVSFORUMS.com -> Database


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group