Joined: 31 Jan 2008 Posts: 148 Location: Chennai, India
I got an SQLCODE=-518 when I execute a dynamic SQL:
-518 THE EXECUTE STATEMENT DOES NOT IDENTIFY A VALID PREPARED STATEMENT
I have written a dynamic SQL which fetches a cursor.
after fteching the cursor immediately I am calling a sub proc which inserts into a table.
If I comment the call statement which calls insert query the cursor is
fetching all the rows. if I uncomment it it is throwing SQLCODE=-518.
I am bypassing the duplicate rows for the insert query by assiging sqlstate=00000.
It would be better if you post the CURSOR declaration statement along with PREPARE statement of the SQL.
One possible problem, 'WITH HOLD' option might be missing in CURSOR declaration. This might be the problem only when your called program is also updating the same table what CURSOR is referring.