DECLARE
x number;
BEGIN
x:=0;
LOOP
x:=x+1;
IF x>=3 THEN EXIT;
END IF;
DBMS_OUTPUT.PUT_LINE('X的值'||x);
END LOOP;
END;
/
DECLARE
x number;
BEGIN
x:=0;
LOOP
x:=x+1;
EXIT WHEN X>=3;
DBMS_OUTPUT.PUT_LINE('X的值'||x);
END LOOP;
END;
/
BEGIN
FOR i In 1..5 LOOP
DBMS_OUTPUT.PUT_LINE('i='||i);
END LOOP;
END;
/
BEGIN
--从大到小 reverse
FOR i In REVERSE 1..5 LOOP
DBMS_OUTPUT.PUT_LINE('i='||i);
END LOOP;
END;
/