View previous topic :: View next topic |
Author |
Message |
mainframemouli Beginner
Joined: 23 Feb 2005 Posts: 87 Topics: 33
|
Posted: Mon Aug 07, 2006 3:29 am Post subject: Error (-510) - for Update of (cursor ) |
|
|
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. |
|
Back to top |
|
|
CZerfas Intermediate
Joined: 31 Jan 2003 Posts: 211 Topics: 8
|
Posted: Mon Aug 07, 2006 3:42 am Post subject: |
|
|
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 |
|
Back to top |
|
|
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Mon Aug 07, 2006 3:44 am Post subject: |
|
|
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). _________________ Shekar
Grow Technically |
|
Back to top |
|
|
mainframemouli Beginner
Joined: 23 Feb 2005 Posts: 87 Topics: 33
|
Posted: Mon Aug 07, 2006 4:45 am Post subject: |
|
|
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. |
|
Back to top |
|
|
|
|