truncate table output
/
-------------------------------------------------------------------------------
-- Example of variable scope
-------------------------------------------------------------------------------

DECLARE                                             -- MAIN block 
    v_parent_var int :=1;
BEGIN
    insert into output values(v_parent_var);            -- OK (local scope)

    DECLARE                                         -- INNER block 
        v_child_var int  :=2 ;
    BEGIN
        v_parent_var := v_parent_var * 10;              -- OK (global)
        v_child_var  := v_child_var  * 10;              -- OK (local)
    END;

    insert into output values(v_parent_var);            -- OK (local)
--  insert into output values(v_child_var);             -- NOT OK
END;

-------------------------------------------------------------------------------
/
SELECT * from output