set serveroutput on;
declare
sum integer := 0;
inc integer := 0;
begin
loop
inc := inc + 1;
if inc > 100 
then
exit;
else
sum := sum + inc;
end if;
end loop;
dbms_output.put_line(sum);
end;运行时有以下错误:
第 11 行出现错误:
ORA-06550: 第 11 行, 第 15 列:
PLS-00103: 出现符号 "+"在需要下列之一时:
(
ORA-06550: 第 14 行, 第 26 列:
PLS-00103: 出现符号 ")"在需要下列之一时:
(刚接触PL/SQL请求大家的帮助。

解决方案 »

  1.   


    declare
        "sum" integer := 0;
        inc integer := 0;
    begin
        loop
            inc := inc + 1;
            if inc > 100 
            then
                exit;
            else
               "sum" := "sum" + inc;
            end if;
        end loop;
        dbms_output.put_line("sum");
    end;sum 应该是关键字, 一般不用关键字声明变量,你非要用的话加上引号
      

  2.   

       LS的说得对、但是记住、如果用了双引号("")、那么Oracle将区分""里面内容的大小写了!