Oracle 函数编译成功但在执行 PLS-00221 时抛出错误:不是过程或未定义 [英] Oracle function compiles successfully but throws error while executing PLS-00221: is not a procedure or is undefined

查看:137
本文介绍了Oracle 函数编译成功但在执行 PLS-00221 时抛出错误:不是过程或未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有简单的oracle函数

I have simple oracle function

create or replace function abs.test_func(test_in in number)
return number
is
   test_out number ;
BEGIN
test_out:=test_in;
RETURN test_out;
END;

如果我编译它 - 它编译成功.但是当我从 PLSQL Developer SQL Window 运行时

if I compile it - it compiles successfully. but when I run from PLSQL Developer SQL Window

 BEGIN abs.test_func(5); END;

我收到以下错误

ORA-06550: line1, column8;
PLS-00221: 'TEST_FUNC' is not a procedure or is undefined
ORA-06550: line1, column8;
PL/SQL: Statement ignored

我的函数有什么问题?

推荐答案

您的 create function 代码看起来不错,但是您没有正确调用该函数.一个函数返回一些东西,你必须select、赋值、打印或求值.

Your create function code looks good, however you are not invoking the function properly. A function returns something, that you must either select, assign, print, or evaluate.

以下是一些有效的函数调用示例:

Here are a few examples of valid function calls:

-- print the return value
begin
    dbms_output.put_line(test_func(5));
end;
/

1 rows affected

dbms_output:
5


-- select the return value
select test_func(5) from dual;

| TEST_FUNC(5) |
| -----------: |
|            5 |

DB Fiddle 演示

这篇关于Oracle 函数编译成功但在执行 PLS-00221 时抛出错误:不是过程或未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆