Home » Other » Client Tools » can't understand warnings in simple Pl/SQL function (Oracle 10g, SqlDeveloper)
can't understand warnings in simple Pl/SQL function [message #512831] Wed, 22 June 2011 07:52 Go to next message
daudiam
Messages: 51
Registered: June 2011
Member
I am using Oracle 10g with SqlDeveloper. When I execute the following code, it says

"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 at the end is also not showing the warnings. Why are the warnings there ?
Re: can't understand warnings in simple Pl/SQL function [message #512832 is a reply to message #512831] Wed, 22 June 2011 07:54 Go to previous messageGo to next message
joy_division
Messages: 4963
Registered: February 2005
Location: East Coast USA
Senior Member
daudiam wrote on Wed, 22 June 2011 08:52

return varchar2(10)


That's a problem I see.
Re: can't understand warnings in simple Pl/SQL function [message #512833 is a reply to message #512832] Wed, 22 June 2011 07:58 Go to previous messageGo to next message
daudiam
Messages: 51
Registered: June 2011
Member
Thanks. That removed the warning. But why wasn't it showing the warnings even when i added SHOW ERRORS at the end ? Is there any other command for showing warnings ?
Re: can't understand warnings in simple Pl/SQL function [message #512835 is a reply to message #512833] Wed, 22 June 2011 08:05 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
There should not be any warnings in this case, just an error. I'd say SQLDevelopers original message was misleading.
Re: can't understand warnings in simple Pl/SQL function [message #512836 is a reply to message #512833] Wed, 22 June 2011 08:05 Go to previous messageGo to next message
Littlefoot
Messages: 21806
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
If you used SQL*Plus, your statement might have been different.
Re: can't understand warnings in simple Pl/SQL function [message #512838 is a reply to message #512833] Wed, 22 June 2011 08:10 Go to previous messageGo to next message
Michel Cadot
Messages: 68624
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
For me, it does:
SQL> create or replace function wafadar
  2  return varchar2(10)
  3  is
  4  
  5  cursor c1 is
  6  SELECT * from emp where deptno=10;
  7  begin
  8    for i in c1
  9    loop
 10      dbms_output.put_line(i.ename);
 11    end loop;
 12    return 'hello';
 13  end;
 14  
 15  /

Warning: Function created with compilation errors.

SQL> sho err
Errors for FUNCTION WAFADAR:
LINE/COL
-------------------------------------------------------------------------------
ERROR
-------------------------------------------------------------------------------
2/16
PLS-00103: Encountered the symbol "(" when expecting one of the following:

   . @ % ; is authid as cluster order using external character
   deterministic parallel_enable pipelined aggregate

No reason it does not do it for you unless you prove the opposite.

Regards
Michel
Re: can't understand warnings in simple Pl/SQL function [message #512841 is a reply to message #512838] Wed, 22 June 2011 08:21 Go to previous messageGo to next message
daudiam
Messages: 51
Registered: June 2011
Member
Thnaks for that, but in SqlDeveloper, i selected the entire code, plus a slash on the next line plus "show error" on the line after that, and executed it. It never showed the exact warning. I even tried "sho err", but to no avail.
Re: can't understand warnings in simple Pl/SQL function [message #512845 is a reply to message #512841] Wed, 22 June 2011 08:34 Go to previous messageGo to next message
cookiemonster
Messages: 13917
Registered: September 2008
Location: Rainy Manchester
Senior Member
Since this is specific to SQLDeveloper I've moved the thread to the client tools forum.
It might help if you said which version of SQLDeveloper you are using.
Mine - 1.0.0.15.57 - doesn't even give a warning message.
Re: can't understand warnings in simple Pl/SQL function [message #512846 is a reply to message #512845] Wed, 22 June 2011 08:39 Go to previous message
daudiam
Messages: 51
Registered: June 2011
Member
SQLDeveloper version 3.0.04
Previous Topic: Update failed ORA-01722:invalid number
Next Topic: SQL Developer/SVN
Goto Forum:
  


Current Time: Thu Mar 28 06:33:06 CDT 2024