Cannot declare a second cursor based on statement <str> Explanation: A prepared statement can only have one cursor based on it. You tried to declare a second cursor based on the same prepared statement name used in a previous DECLARE CURSOR statement. User Action: Remove one of the cursor definitions from your program or base the second cursor on a different statement name.