You are on page 1of 2

SET Serveroutput ON DECLARE i number(2); BEGIN i:=1; LOOP DBMS_OUTPUT.

PUT_LINE(i); i:=i+1; EXIT WHEN i>10; END LOOP; END;

SET Serveroutput ON DECLARE i char(2); BEGIN i:=1; WHILE i<=10 LOOP DBMS_OUTPUT.PUT_LINE(i*i); i:=i+1; SET Serveroutput ON DECLARE n number(2); fact number(2); i number(2); BEGIN i:=1; fact:=1; n:=&n; LOOP fact:=fact*(n-1); DBMS_OUTPUT.PUT_LINE(fact); i:=i+1; EXIT WHEN i<10; END LOOP; END;

SET Serveroutput ON DECLARE total number(2); i number(2); BEGIN FOR i IN 1..10 LOOP total:=2*i; DBMS_OUTPUT.PUT_LINE('2*'||i||'='||total); END LOOP; END; SET Serveroutput ON DECLARE i number(2);

n number(2); BEGIN FOR i IN 1..10 LOOP n:=i+1; DBMS_OUTPUT.PUT_LINE(n); n:=i*1; DBMS_OUTPUT.PUT_LINE(n); END LOOP; END; SET Serveroutput ON DECLARE week char(50); i number(2); BEGIN i:=&i if i:=1 then GOTO a; elsif i:=2 GOTO b; elsif i:=3 GOTO c; elsif i:=4 GOTO d; elsif i:=5 GOTO e; else GOTO f; END IF; <<a>> DBMS_OUTPUT.PUT_LINE('today is sunday'); <<b>> DBMS_OUTPUT.PUT_LINE('today is monday'); <<c>> DBMS_OUTPUT.PUT_LINE('today is tuesday'); <<d>> DBMS_OUTPUT.PUT_LINE('today is wednesday'); <<e>> DBMS_OUTPUT.PUT_LINE('today is thursday'); <<f>> DBMS_OUTPUT.PUT_LINE('today is saturday'); END;

You might also like