Oracle nested blocks and exception handling

oracle, oracle11g, plsql

Solution

DECLARE
string_of_5_chars VARCHAR2(5);
BEGIN
BEGIN
    string_of_5_chars := 'Steven';  -- Varchar has a size of 5 defined above. So it will throw a value_error(due to size constraints) exception.
EXCEPTION
    WHEN value_error THEN    -- This exception block will handle the error thrown above.
      RAISE no_data_found;   -- It raises a no_data _found exception which by rule has to be handled in the outer exception block. So it goes to the outer exception block.
    WHEN no_data_found THEN
      dbms_output.Put_line ('Inner block');
END;
EXCEPTION
WHEN no_data_found THEN
  dbms_output.Put_line ('Outer block'); -- Exception is handled here which causes it to print 'Outer Block'
END;

Read here for more information about nested exception blocks.

Problem

``` DECLARE string_of_5_chars VARCHAR2(5); BEGIN BEGIN string_of_5_chars := 'Steven'; EXCEPTION WHEN value_error THEN RAISE no_data_found; WHEN no_data_found THEN dbms_output.Put_line ('Inner block'); END; EXCEPTION WHEN no_data_found THEN dbms_output.Put_line ('Outer block'); END; ``` Answer says that the output will be 'Outer block' , Can somebody explain why the inner block would not be executed ? What is the precedence of exceptions in oracle

Original source