PLS-00222: stored procedure's "select" calls a user-defined function

From: william milbratz <milbratz_at_hotmail.com>
Date: 5 Feb 2003 16:16:45 -0800
Message-ID: <cee3515e.0302051616.42b905a5_at_posting.google.com>


Hi,

This problem occurs on Oracle 8.1.7.0.0 It works fine on 9.0.1.1.1. (I need to support both versions; hence the concern).

Oracle throws a PLS-00222 error when I call a user-defined function from a select statement in a stored procedure. Oddly the procedure compiles OK when I qualify the function with the schema name.

The usual google/newsgroup search didn't come up with any similar complaints.

For 8i, do I need to qualify the schema name when I call, from within a stored procedure's select statement, a user defined function? Can I get around this requirement? I'd like to keep the code 'unaware' of its schema name if possible.

examples are below. thanks in advance,

bill m

This doesn't work:

CREATE OR REPLACE PROCEDURE rpt_upd_summary_month (

	from_date date,
	to_date date) AS
BEGIN
      delete from rpt_table_month
      where 
      year_month
      between
    year_month(rpt_upd_summary_month.from_date)        
  
      and
    year_month(rpt_upd_summary_month.to_date)        

;

end;

but if I qualify the calls to 'year_month', it works. ('pe' is the current schema):

CREATE OR REPLACE PROCEDURE rpt_upd_summary_month (

	from_date date,
	to_date date) AS
BEGIN
      delete from rpt_table_month
      where 
      year_month
      between
    pe.year_month(rpt_upd_summary_month.from_date)          
      and
    pe.year_month(rpt_upd_summary_month.to_date)        

;

end;

where year_month is

CREATE OR REPLACE FUNCTION year_month (

	in_date date
          )          
         return varchar
 AS
               return_var VARCHAR(7);
      BEGIN
       select to_char(year_month.in_date,'YYYY-MM')
        into  return_var  from dual;  
                   /* Return */
                   return return_var;                  
END; Received on Thu Feb 06 2003 - 01:16:45 CET

Original text of this message