Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: PLS-307 error - makes no sense
If I recall correctly, you can have an overloaded function or procedure in a package BUT they must be different in the PARAMETERS and not in what they return.
You would need to have one of the functions have VARCHAR2, VARCHAR2 for parameters
and the other needs to be another combination of datatypes.
> 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:
>
> 1. function or procedure name
> 2. data types of arguments
> 3. mode of arguments ( IN, OUT, IN OUT )
> 4. return value in the case of a function
>
> 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
> ) return boolean;
>
> function login(
> username_in varchar2
> , password_in varchar2
> ) return varchar2;
>
> end;
> /
>
> show errors package ftest
>
> create or replace package body ftest
> is
>
> function login(
> username_in varchar2
> , password_in varchar2
> ) return boolean
> is
> begin
> return true;
> end;
>
> function login(
> username_in varchar2
> , password_in varchar2
> ) return varchar2
> is
> login_success boolean := false;
> begin
>
> login_success := login(
> username_in
> , password_in
> );
>
> if login_success then
> return 'LOGIN';
> else
> return 'NOLOGIN';
> end if;
> end;
>
> end;
> /
>
> show errors package body ftest
> ===========================
>
> Try to compile this and you will get :
>
> Errors for PACKAGE BODY FTEST:
>
> LINE/COL
> --------------------------------------------------------------------------
-- Please see the official ORACLE-L FAQ: http://www.orafaq.com -- Author: Babette Turner-Underwood INET: babattt_at_home.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 - 21:01:00 CDT
![]() |
![]() |