Tuesday, January 18, 2011

Oracle - GOTO Statement


Example of GOTO Statement:

DECLARE

   EX1 VARCHAR2(50);
   FLAG BOOLEAN := FALSE;
  

BEGIN
    EX1 := '&EX1';  

   BEGIN
    IF(EX1 IS NOT NULL) THEN
   
        GOTO LABEL1;
    END IF;   
   
   END;
  
   <<LABEL2>>
   BEGIN
    DBMS_OUTPUT.PUT_LINE('SKIP THIS BLOCK');
   END;
  
  
   <<LABEL1>>
   BEGIN
    DBMS_OUTPUT.PUT_LINE('GO TO HAS BEEN EXECUTED');
  
   END;

END;

No comments:

Post a Comment