RPG (IBM i / AS/400) · DB2 SQLCODE
What does SQLCODE -517 - Cursor Cannot Be Associated With Prepared Statement mean in RPG (IBM i / AS/400)?
A DECLARE CURSOR referenced a statement name whose prepared statement is not a SELECT, so SQL cannot associate a cursor with it.
A DECLARE CURSOR referenced a statement name whose prepared statement is not a SELECT, so SQL cannot associate a cursor with it.
Confirm the dynamic SQL text being PREPAREd is actually a SELECT before declaring a cursor for it, and route non-SELECT dynamic statements through EXECUTE IMMEDIATE or EXECUTE instead.