日期:2014-05-17  浏览次数:20830 次

新手写PL/SQL程序时出现的错误。
SQL code
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请求大家的帮助。

------解决方案--------------------
SQL code

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;

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