Can't understand warnings in simple Pl / SQL function

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

"FUNCTION wafadar compiled Warning: execution ended 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 at the end also does not display warnings. Why are there warnings?

+1


source to share


1 answer


Errors!

You have to take care of errors first, and I'm sure you have one in the return clause of your function (you cannot specify the size of varchar2 ".

Warnings

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

How to see alerts (include the categories you need)

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

      

Check

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

      



Your warnings:

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

 show errors

      

or

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 read a little:

+8


source







All Articles