create or replace procedure Test1(numbera number)
as
testresult number(4);
begin
testresult:=0;
for tempa in 0..numbera loop
begin
testresult:=testresult+tempa;
end;
end loop;
dbms_output.put_line('the result is '||testresult);
end;
注明:
单纯的oracle存储过程中使用for循环语句,特别要注意tempa不能作为操作目标对象。
本文详细介绍了在Oracle存储过程中使用for循环的基本语法,并着重指出在操作目标对象时应避免将临时变量tempa直接作为操作对象。通过示例程序,展示了如何正确地在循环中累加变量并输出结果。
2万+

被折叠的 条评论
为什么被折叠?



