In oracle pro *c/c++
EXEC SQL WHENEVER SQLERROR DO break;
What this statement actually do? This inserts the break statement at all the following exec sql statements?
How to limit the scope of do break?
DO BREAK
An actual "break" statement is placed in your program. Use this action in loops. When the WHENEVER condition is met, your program exits the loop it is inside.
So whenever an error is encountered, a break
will be issued, which won't mean much outside a loop. If you want to reset the behaviour after a particular statement, issue EXEC SQL WHENEVER SQLERROR CONTINUE;
to reset to the default error handling behaviour:
CONTINUE
Your program continues to run with the next statement if possible. This is the default action, equivalent to not using the WHENEVER directive. You can use it to turn off condition checking.
Effectively you can sandwich a statement between two WHENEVER
directives to make it apply only to that statement.