What is scope of ContinueHandler in below scenario?. Is stmt2 covered for exception handling by continue handler?
BEGIN
DECLARE CONTINUE HANDLER FOR ...; -- handler H1
stmt1;
stmt2;
END;
As documented under Scope Rules for Handlers:
A handler declared in a
BEGIN ... ENDblock is in scope only for the SQL statements following the handler declarations in the block. If the handler itself raises a condition, it cannot handle that condition, nor can any other handlers declared in the block. In the following example, handlersH1andH2are in scope for conditions raised by statementsstmt1andstmt2. But neitherH1norH2are in scope for conditions raised in the body ofH1orH2.BEGIN -- outer block DECLARE EXIT HANDLER FOR ...; -- handler H1 DECLARE EXIT HANDLER FOR ...; -- handler H2 stmt1; stmt2; END;
An exception occurs in stmt2, will declare continue handler catch this?EXIT HANDLER, but could just as well have done so using CONTINUE HANDLER.
handler? with acursoror not?