declare
counter number :=0;
result number;
begin
loop
counter := counter+1;
result := 19*counter;
dbms_output.put_line('19'||'*'||counter||'='||result);
if counter>=10
then exit;
end if;
end loop;
end;
Same code
declare
counter number :=0;
result number;
begin
loop
counter := counter+1;
result := 19*counter;
dbms_output.put_line('19'||'*'||counter||'='||result);
EXIT WHEN counter>=10;
end loop;
end;
--while loop
declare
counter number :=1;
result number;
begin
while counter<=10 loop
result := 19*counter;
dbms_output.put_line('19'||'*'||counter||'='||result);
counter := counter+1;
end loop;
end;
--for loop
declare
result number;
begin
for i in 1..10 loop
result := 19*i;
dbms_output.put_line('19'||'*'||i||'='||result);
end loop;
end;
output will be shown as
19*1=19
19*2=38
19*3=57
19*4=76
19*5=95
19*6=114
19*7=133
19*8=152
19*9=171
19*10=190
---
counter number :=0;
result number;
begin
loop
counter := counter+1;
result := 19*counter;
dbms_output.put_line('19'||'*'||counter||'='||result);
if counter>=10
then exit;
end if;
end loop;
end;
Same code
declare
counter number :=0;
result number;
begin
loop
counter := counter+1;
result := 19*counter;
dbms_output.put_line('19'||'*'||counter||'='||result);
EXIT WHEN counter>=10;
end loop;
end;
--while loop
declare
counter number :=1;
result number;
begin
while counter<=10 loop
result := 19*counter;
dbms_output.put_line('19'||'*'||counter||'='||result);
counter := counter+1;
end loop;
end;
--for loop
declare
result number;
begin
for i in 1..10 loop
result := 19*i;
dbms_output.put_line('19'||'*'||i||'='||result);
end loop;
end;
output will be shown as
19*1=19
19*2=38
19*3=57
19*4=76
19*5=95
19*6=114
19*7=133
19*8=152
19*9=171
19*10=190
---
0 comments:
Post a Comment