Eugene Krivdyuk wrote:
I'm trying to make a call of packaged stored procedure, e.g.:

=================== perl code ===================
  $sSQL = q{
    begin

      package.function_name( :i_param1
                                   , :i_param2
                                   , :i_param3
                                   , :o_param1
                                   );
    end;
  };

  $sth = $dbh->prepare($sSQL);

  $sth->bind_param(':i_param1', 1);
  $sth->bind_param(':i_param2',  $sDateStart, { ora_type => ORA_VARCHAR2 });
  $sth->bind_param(':i_param3',  $sDateEnd,  { ora_type => ORA_VARCHAR2 });

  $sth->bind_param_inout( ':o_param1', \$iDaysCnt, 100000, { ora_type
=> ORA_NUMBER } );

  $sth->execute;
=================== perl code ===================

function_name is an overloaded PL/SQL stored procedure, one accepts
i_param2 & i_param3 of type DATE, second accepts i_param2 & i_param3
of type VARCHAR2.
When executing code like above, I'm getting this error:

   PLS-00307: too many declarations of 'function_name' match this call

Is there any way to make it work?


I believe this is the right error for what you have done because the only way for oracle to know which function you meant is if the bound parameters match the right function. Since you are binding dates as varchars and oracle can convert varchars to various types how can it know which function you meant? If it isn't that, then it may depend on what is bound for the date/varchar parameters e.g., if they are NULL then Oracle won't know which function you meant (there is an example of this at http://oraclequirks.blogspot.com/2007/05/pls-00307-too-many-declarations-of-xyz.html). Obviously renaming the functions would be an answer or changing them so they have different numbers of arguments but I presume you cannot do this. I don't know what else to suggest and I don't think this is caused by DBD::Oracle - I think you'd have a similar problem in pl/sql.

Personally I don't like overloaded functions in Oracle as whenever I've come across them they have led to confusion; especially so when they have defaults for parameters too.

Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

Reply via email to