Hi,
I have made a test with your code fragment and the error occurred for me too. 
It seems that this may a bug with in the C/C++ Precompiler. I will look for a 
workaround 
for your.
Thanks you for sending the code.

Regards,
Burkhard
 
--
SAP DB, SAP Labs Berlin
http://www.sapdb.org/
 
-----Original Message-----
From: Thomas Lorenz [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 08, 2003 7:09 PM
To: [EMAIL PROTECTED]
Subject: probs with update after fetch


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
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to