无法理解简单的Pl/SQL函数中的警告 [英] can't understand warnings in simple Pl/SQL function

查看:262
本文介绍了无法理解简单的Pl/SQL函数中的警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将Oracle 10g与SqlDeveloper一起使用.当我执行以下代码时,它说

I am using Oracle 10g with SqlDeveloper. When I execute the following code, it says

已编译的功能wafadar 警告:执行完成并显示警告"

"FUNCTION wafadar compiled Warning: execution completed with warning"

create or replace function wafadar
return varchar2(10)
is

cursor c1 is
SELECT employee_id,first_name FROM employees where department_id=50 ;

begin
  for i in c1
  loop
    dbms_output.put_line(i.first_name);
  end loop;
  return 'hello';
end;

最后的SHOW ERRORS也未显示警告.为什么会有警告?

SHOW ERRORS at the end is also not showing the warnings. Why are the warnings there ?

推荐答案

错误!

首先,您应该注意错误,我敢打赌,您的函数的return子句中有一个(您不能指定" varchar2 >".

At first, you should care about errors, and I bet you have one on the return clause of your function (you can't specify the size of the "varchar2".

警告

您是否在手册中寻找警告"? http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/errors.htm#LNPLS00711

Did you look for "warning" in the manuals? http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/errors.htm#LNPLS00711

如何查看警告(启用所需的类别)

alter function wafadar compile plsql_warnings='ENABLE:ALL' reuse settings

检查:

select plsql_warnings
from   user_plsql_object_settings ps
where  ps.name = 'WAFADAR'

您的警告:

诸如sql * plus或Sql Developer(如果支持)之类的客户端工具:

Client tools like sql*plus or Sql Developer(if supported):

 show errors

select *
from   user_errors ur
where  ur.name = 'WAFADAR'

NAME                           TYPE           SEQUENCE       LINE   POSITION TEXT                                                                             ATTRIBUTE MESSAGE_NUMBER
------------------------------ ------------ ---------- ---------- ---------- -------------------------------------------------------------------------------- --------- --------------
WAFADAR                        FUNCTION              1          1          1 PLW-05018: unit WAFADAR omitted optional AUTHID clause; default value DEFINER us WARNING             5018


最后,建议您阅读以下内容:


Finally, I suggest you to read a little bit of:

  1. 如何提问: http://www.catb.org/~esr/faqs /smart-questions.html#before
  2. http://download.oracle.com/docs/cd/E11882_01 /appdev.112/e17126/toc.htm
  3. 所有" oracles "都在这里: http://tahiti.oracle.com/
  4. SQL开发人员 oracles (如果您想使用它!):
  1. How to ask: http://www.catb.org/~esr/faqs/smart-questions.html#before
  2. http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17126/toc.htm
  3. All the "oracles" are here: http://tahiti.oracle.com/
  4. Sql developer oracles(if you want to use it!): http://download.oracle.com/docs/cd/E11882_01/doc.112/e12152/toc.htm

这篇关于无法理解简单的Pl/SQL函数中的警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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