PL/SQL 函数存在吗?

发布于 2024-10-25 23:05:58 字数 1516 浏览 2 评论 0原文

我正在尝试创建一个名为 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.)

它存在还是不存在?我做错了什么?

I am trying to create a function called add_extra.

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

However, when I run the script, it says:

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:

And when I try: DROP FUNCTION add_extra; It tells me:

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.)

Does it exist or does it not exist? What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情魔剑神 2024-11-01 23:05:58
CREATE OR REPLACE FUNCTION add_extra(p_price IN NUMBER)

您的查询中缺少 __IN__ 关键字。

CREATE OR REPLACE FUNCTION add_extra(p_price IN NUMBER)

__IN__ keyword is missing in your query.

作死小能手 2024-11-01 23:05:58

我几乎可以肯定它是一个FUNCTION,但它是一个PROCEDURE
因此,DROP PROCEDURE ADD_EXTRA; 起作用了。

I was almost certain it was a FUNCTION, but it was a PROCEDURE!
So, DROP PROCEDURE ADD_EXTRA; worked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文