Plsql pl sql中的while循环出错

Plsql pl sql中的while循环出错,plsql,while-loop,Plsql,While Loop,在Pl Sql中,我使用while循环计算从1到10的整数 代码如下: set serveroutput on; declare i number := 0; sum number := 0; begin while i <= 10 loop sum := sum + i ; i := i + 1; end loop; dbms_output.put_line ( sum ); end; / 尽量不要使用变量名sum i、 e 打开服务器输出; 声明 i编号:=0; s编号:=0; 开始

在Pl Sql中,我使用while循环计算从1到10的整数

代码如下:

set serveroutput on;
declare
i number := 0;
sum number := 0;
begin
while i <= 10 loop
sum := sum + i ;
i := i + 1;
end loop;
dbms_output.put_line ( sum );
end;
/

尽量不要使用变量名
sum

i、 e

打开服务器输出;
声明
i编号:=0;
s编号:=0;
开始

而我请补充什么是错误的,什么是你所期待的。有错误消息吗?哦,这是错误消息sum:=sum+i;*第6行错误:ORA-06550:第6行,第12列:PLS-00103:在预期以下情况时遇到符号“+”:(ORA-06550:第9行,第28列:PLS-00103:在预期以下情况时遇到符号“)”:(
sum := sum + i ;
           *
ERROR at line 6: 
ORA-06550: line 6, column 12: 
PLS-00103: Encountered the symbol "+" when expecting one of the following: 
( 
ORA-06550: line 9, column 28: 
PLS-00103: Encountered the symbol ")" when expecting one of the following: 
(
set serveroutput on;
declare
i number := 0;
s number := 0;
begin
while i <= 10 loop
s := s + i ;
i := i + 1;
end loop;
dbms_output.put_line ( s );
end;
/