Monday, March 2, 2009

Go To

Can't branch:
  • to a inner block
  • into an if statement
  • into a loop
  • from exception handler back into block

  • DECLARE
    v_Ctr BINARY_INTEGER := 1;
    BEGIN
    Dbms_Output.Put_line ('Start');
    LOOP
    Dbms_Output.Put_line (v_Ctr || ' Loop count');
    v_Ctr := v_Ctr + 1;

    IF v_Ctr > 8 THEN
    GOTO l_EndOfLoop;
    END IF;

    END LOOP;

    <<l_EndOfLoop>>
    Dbms_Output.Put_line ('Done!');
    END;
    /

    No comments:

    Post a Comment