2012-05-16 24 views
1

功能我创建的时候:PLS-00103:出现符号 “” 期待以下... [PL/SQL]的一个

SQL> create or replace function sum(first number,second number) return number is result number:= 0; begin result:=first+second; return result; end sum; 
2/

Function created. 

,这里是我如何编译:

set serveroutput on; 
begin 
dbms_output.put_line(sum(1,1)); 
end; 
/

编译后,出现以下错误:

ERROR at line 2: 
ORA-06550: line 2, column 27: 
PLS-00103: Encountered the symbol "," when expecting one of the following: 
) * & - +/at mod remainder rem <an exponent (**)> || 
multiset 
+1

考虑到'SUM'是一个保留字和一个内置的聚集函数,这对于一个自定义函数名是一个愚蠢的选择。尝试'ADD_NUMBERS'或什么 – Bohemian

+0

@波希米亚谢谢你,我还在学习,那是我第一次尝试。 –

回答

4

我的猜测是,这与事实,SUM是现有的有趣的事情在PL/SQL中使用。尝试改变你的功能的名称MYSUM或其他东西,看看是否修复它。

+0

谢谢,它工作:) –

相关问题