PL / SQL函数存在吗?

时间:2011-03-22 10:20:30

标签: function plsql ora-00955

我正在尝试创建一个名为add_extra的函数。

CREATE OR REPLACE FUNCTION add_extra(p_price NUMBER)
RETURN NUMBER
IS
BEGIN
  RETURN(9000);
END add_extra;

然而,当我运行脚本时,它说:

Error starting at line 1 in command:
CREATE OR REPLACE FUNCTION add_extra(p_price NUMBER)
RETURN NUMBER
IS
BEGIN
  RETURN(9000);
END add_extra;
Error report:
ORA-00955: name is already used by an existing object
00955. 00000 -  "name is already used by an existing object"
*Cause:    
*Action:

当我尝试:DROP FUNCTION add_extra;它告诉我:

Error starting at line 1 in command:
DROP FUNCTION add_extra
Error report:
SQL Error: ORA-04043: object ADD_EXTRA does not exist
04043. 00000 -  "object %s does not exist"
*Cause:    An object name was specified that was not recognized by the system.
               There are several possible causes:
           - An invalid name for a table, view, sequence, procedure, function,
           package, or package body was entered. Since the system could not
           recognize the invalid name, it responded with the message that the
           named object does not exist.
           - An attempt was made to rename an index or a cluster, or some
           other object that cannot be renamed.
*Action:   Check the spelling of the named object and rerun the code. (Valid
           names of tables, views, functions, etc. can be listed by querying
           the data dictionary.)

是否存在或不存在?我做错了什么?

2 个答案:

答案 0 :(得分:1)

CREATE OR REPLACE FUNCTION add_extra(p_price IN NUMBER)
您的查询中缺少

__IN__个关键字。

答案 1 :(得分:0)

我几乎可以肯定它是FUNCTION,但它是PROCEDURE! 所以,DROP PROCEDURE ADD_EXTRA;有效。