Showing posts with label overloading. Show all posts
Showing posts with label overloading. Show all posts

Wednesday, May 16, 2007

PLS-00307: too many declarations of XYZ match this call

While doing some tests before publishing my previous posting, i came across the following exception that is to be rarely seen when calling overloaded procedures (or functions) like this APEX_MAIL.SEND:

declare
var_addressee varchar2(255) := '...';
var_sender varchar2(255) := '...';
var_title varchar2(80);
begin
apex_mail.send(
p_to => var_addressee,
p_from => var_sender,
p_subj => var_title,
p_body => null);
end;

ORA-06550: line 6, column 1:
PLS-00307: too many declarations of 'SEND' match this call
ORA-06550: line 6, column 1: PL/SQL: Statement ignored

The problem is highlighted in purple.
Since APEX_MAIL.SEND comes in two versions (in other words it is an overloaded procedure), if we pass null to parameter p_body, the parser cannot decide whether it should reference the function version accepting p_body as VARCHAR2 or the version accepting p_body as CLOB.

The workaround is to replace null with some more meaningful expression.
Note that in general it could be enough to store null into a variable of the desired type, but this is not the case of APEX_MAIL.SEND that would just return the error i described in my previous posting.

yes you can!

Two great ways to help us out with a minimal effort. Click on the Google Plus +1 button above or...
We appreciate your support!

latest articles