PL/SQL WHILE loop is used to execute statements as long as given condition is true and the condition is checked at the beginning of each iteration
The syntax of PL/SQL While loop is like this
WHILE condition
statements to execute
END LOOP;
Look at this sample code for better understanding
DECLARE -- Counter variable i int :=1; -- Value for table j int :=5; BEGIN -- Check While condition at the start of iteration WHILE i<11 LOOP -- Print table of varibale j dbms_output.put_line(j||'*'||i||'='||i*5); -- Increment counter i:=i+1; END LOOP; END;
and output is
Cheers :) Happy Learning
No comments :
Post a Comment