Home » SQL & PL/SQL » SQL & PL/SQL » Need help in function (Orcale 10g R2)
Need help in function [message #445851] Thu, 04 March 2010 06:32 Go to next message
ali560045
Messages: 25
Registered: May 2009
Junior Member
Hello ,

Below is the fucntion that is showing the following compilation errors .Can anyone help me in telling what is the exact problem

Errors for FUNCTION FX_SUBQUALITIES:


SQL> create or replace FUNCTION MESSAGE_REPORT.FX_SUBQUALITIES
  2  RETURN quality_table
  3  deterministic
  4  AS
  5   v_ret   quality_table;
  6  BEGIN
  7   v_ret  := quality_table();
  8  
  9      v_ret.extend;
 10      v_ret(v_ret.count) := 'A1';
 11      v_ret.extend;
 12      v_ret(v_ret.count) := 'A2';
 13      v_ret.extend;
 14      v_ret(v_ret.count) := 'A3';
 15      v_ret.extend;
 16      v_ret(v_ret.count) := 'A4';
 17      v_ret.extend;
 18      v_ret(v_ret.count) := 'B';
 19      v_ret.extend;
 20      v_ret(v_ret.count) := 'C';
 21      v_ret.extend;
 22      v_ret(v_ret.count) := 'D1';
 23      v_ret.extend;
 24      v_ret(v_ret.count) := 'D2';
 25      v_ret.extend;
 26      v_ret(v_ret.count) := 'D3';
 27      v_ret.extend;
 28      v_ret(v_ret.count) := 'D4';
 29      v_ret.extend;
 30      v_ret(v_ret.count) := 'D5';
 31      v_ret.extend;     
 32      v_ret(v_ret.count) := 'E';
 33  
 34  
 35      return v_ret;
 36  END;
 37  /

Warning: Function created with compilation errors.

SQL> sho err
Errors for FUNCTION MESSAGE_REPORT.FX_SUBQUALITIES:

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      PL/SQL: Compilation unit analysis terminated
2/8      PLS-00201: identifier 'QUALITY_TABLE' must be declared




Re: Need help in function [message #445852 is a reply to message #445851] Thu, 04 March 2010 06:36 Go to previous messageGo to next message
Michel Cadot
Messages: 63812
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
SQL Reference, CREATE FUNCTION

RETURN Clause: RETURN datatype
For datatype, specify the datatype of the return value of the function. Because every function must return a value, this clause is required. The return value can have any datatype supported by PL/SQL.

The keyword here is DATATYPE, see your line 2, what is "quality_table"?

Regards
Michel


[Updated on: Thu, 04 March 2010 06:36]

Report message to a moderator

Re: Need help in function [message #445853 is a reply to message #445851] Thu, 04 March 2010 06:36 Go to previous message
ramoradba
Messages: 2454
Registered: January 2009
Location: AndhraPradesh,Hyderabad,I...
Senior Member
it is saying like i dont know anything about "'QUALITY_TABLE' "
Please tell me what is that?

sriram Smile
Previous Topic: Execute Immediate Issue (merged 4)
Next Topic: Truncate table error
Goto Forum:
  


Current Time: Fri Sep 30 05:29:36 CDT 2016

Total time taken to generate the page: 0.16329 seconds