Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> PLS-307 error - makes no sense
Dear List,
First off, this is kind of long, so don't start reading unless you have some time. :)
I've run into this before, and now I can't remember how to resolve it.
( database is 8.1.7.0 )
The Signature of a procedure or function is made up of:
There are some other special cases, but this is enough for this discussion.
The documentataion is quite clear on one thing; changing the name of an argument will *not* change the signature.
Here's some code to demonstrate
create or replace package ftest
is
function login(
username_in varchar2 , password_in varchar2
function login(
username_in varchar2 , password_in varchar2
end;
/
show errors package ftest
create or replace package body ftest
is
function login(
username_in varchar2 , password_in varchar2
return true;
end;
function login(
username_in varchar2 , password_in varchar2
login_success boolean := false;
begin
login_success := login( username_in , password_in ); if login_success then return 'LOGIN'; else return 'NOLOGIN'; end if;
end;
/
show errors package body ftest
Try to compile this and you will get :
Errors for PACKAGE BODY FTEST:
LINE/COL
21/21
PLS-00307: too many declarations of 'LOGIN' match this call
The signatures of these two function are different: one returns a boolean
and the other returns a varchar. The login() function that returns a
varchar
should be able to call a function of the same name and arguments that
returns a boolean. But it doesn't work.
The code below does work. Notice the two changes. The login() function that returns a boolean now has a prefix of 'b_' on it's input arguments.
The login() function that returns a varchar now uses named parameters to call the login() function that returns a boolean.
Both of these changes are necessary to make this work.
Any ideas?
Thanks
Jared
create or replace package ftest
is
function login(
b_username_in varchar2 , b_password_in varchar2
function login(
username_in varchar2 , password_in varchar2
end;
/
show errors package ftest
create or replace package body ftest
is
function login(
b_username_in varchar2 , b_password_in varchar2
return true;
end;
function login(
username_in varchar2 , password_in varchar2
login_success boolean := false;
begin
login_success := login( b_username_in => username_in , b_password_in => password_in ); if login_success then return 'LOGIN'; else return 'NOLOGIN'; end if;
end;
/
show errors package body ftest
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: INET: Jared.Still_at_radisys.com Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists -------------------------------------------------------------------- To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing).Received on Thu Aug 23 2001 - 14:58:29 CDT
![]() |
![]() |