I am developing stored procedures in SQL. Cursor operation NOT FOUND conditions are being handled with a CONTINUE HANDLER. The problem I have is that I have SQL Statements that are also potentially raising SQLSTATE 02000 - ones that might try an assignment to a variable with a SET or a SELECT INTO (the later of which is raising SQLSTATE 02000 if the WHERE clause is not met) and then more importantly, INSERT INTO statements that again might produce an empty result set. When these statements raise SQLSTATE 02000 my continue handler is called and the cursor loop exits.
I know that I can do existence tests before, but such a test is then followed by the exact same statement if it is true... that seems quite inefficient. Does anyone have any suggestions on other approaches?
I know that I can do existence tests before, but such a test is then followed by the exact same statement if it is true... that seems quite inefficient. Does anyone have any suggestions on other approaches?