我正在尝试创建一个名为add_extra
的函数。PL/SQL函数是否存在?
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.)
是否存在或是否不存在?我究竟做错了什么?
难道是功能存在,但你没有权利看到它?您是否试图在您登录的模式中创建函数,或者您是否使用“alter session set current_schema ...”来针对不同的模式工作?您是否试图明确指定模式(CREATE OR REPLACE FUNCTION MYUSER.ADD_EXTRA ...)? – Codo 2011-03-22 10:37:13
我不确定,但我想它是在我登录的模式中,因为所有其他函数,过程等都出现在对象列表中。另外,当我使用username.add_extra时,我得到相同的错误。 – whirlwin 2011-03-22 10:46:46
此查询可能有助于确定您的对象位于哪个模式(“OWNER”)中:SELECT * FROM ALL_OBJECTS WHERE OBJECT_NAME ='ADD_EXTRA'' – 2011-03-22 11:00:05