Hi!

My esql-statements drive me crazy and I'm very confused about the following
code fragment (that works under DB2/AIX, so it's no code that was written
new):
<snip>
/* declare cursor */
EXEC SQL
DECLARE SelUp CURSOR
FOR SELECT ANFORDERUNG_ID
FROM TB14
FOR UPDATE OF ANFORDERUNG_ID;

/* open cursor */
EXEC SQL OPEN SelUp;

/* read data form an open cursor */
EXEC SQL
FETCH SelUp INTO  :hv_anforderung_id;

pDB->l_anforderung_id = hv_anforderung_id;
++hv_anforderung_id;

 /* update with incremented key*/
EXEC SQL
UPDATE TBP14
SET ANFORDERUNG_ID = :hv_anforderung_id
WHERE CURRENT OF SelUp;
<snip>

Everything works fine until the last statement. Unfortunately I got
sqlcode -7026 "SQL statement not allowed without previous FETCH". I have no
idea about that. The syntax of the update-statement seems to be ok.
Any suggestions?

Thanks in advance!
Thomas





_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to