「Oracle入門」loop、while、forでPROCEDUREを作成する

1.loop構文
loop
statements;
end loop;
サンプル
counter := 0;
loop
counter := counter + 1;
exit when counter = 10;
end loop;

2.while構文
while condition loop
statements
end loop;

サンプル
counter := 0;
while counter < 6 loop
counter := counter + 1;
end loop;

3.for構文
for loop_variable in [reverse] lower_bound.. upper_bounder loop
statements
end loop;
サンプル
for count2 in 1..10 loop
DBMS_OUTPUT.PUT_LINE(count2);
end loop;

Comments are closed.