用PL/SQL计算1-100之间自然数的和?
计算出来的值为 : 5050
set serveroutput on;
declare
counter number:=0;
sumresult number:=0;
begin
for counter in 1..100 loop
sumresult:=sumresult+counter;
end loop;
dbms_output.put_line('result is:' || sumresult);
end;
计算出来的值为 : 5050
set serveroutput on;
declare
counter number:=0;
sumresult number:=0;
begin
for counter in 1..100 loop
sumresult:=sumresult+counter;
end loop;
dbms_output.put_line('result is:' || sumresult);
end;
相关推荐