Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.tools -> Re: Overloading package functions

Re: Overloading package functions

From: Sybrand Bakker <postbus_at_sybrandb.demon.nl>
Date: Wed, 22 Nov 2000 19:18:39 +0100
Message-ID: <8vh43v$4is9e$10@ID-62141.news.dfncis.de>

"Rastko Potocnik" <ratislav.potocnik_at_guest.arnes.si> wrote in message news:uCRS5.10$6Z.545_at_news.siol.net...
> I want to overload a function in PL/SQL package wich returns
>
> 1.) 0 or SQLCODE on error and free (not existing) object name as output
> parameter
> 2.) free object name or NULL on error
>
> The package is compiled successfully but when I call function I get
> PLS-00307 error (too many declarations of func_name match this call.
>
> Should I declare overloading in some way and if yes, how?
>
> declaration in packagespec:
>
> FUNCTION TMP_OBJECT_NAME
> (object_name OUT VARCHAR2, prefix IN VARCHAR2 := '') RETURN
 NUMBER;
>
> FUNCTION TMP_OBJECT_NAME
> (prefix IN VARCHAR2 := '') RETURN VARCHAR2;
>
> package body code:
>
> FUNCTION TMP_OBJECT_NAME(object_name OUT VARCHAR2, prefix IN VARCHAR2 :=
 '')
> RETURN NUMBER IS
>
> i_ret NUMBER;
> v_name USER_OBJECTS.OBJECT_NAME%TYPE;
> BEGIN
> i_ret := priv_TMP_OBJECT_NAME(v_name, prefix);
> if i_ret = 0 then
> object_name := v_name;
> end if;
> RETURN i_ret;
> EXCEPTION
> WHEN OTHERS THEN RETURN SQLCODE;
> END;
>
> FUNCTION TMP_OBJECT_NAME(prefix IN VARCHAR2 := '')
> RETURN VARCHAR2 IS
>
> i_ret NUMBER;
> v_name USER_OBJECTS.OBJECT_NAME%TYPE;
> BEGIN
> i_ret := priv_TMP_OBJECT_NAME(v_name, prefix);
> if i_ret = 0 then
> RETURN v_name;
> else
> RETURN NULL;
> end if;
> EXCEPTION
> WHEN OTHERS THEN RETURN NULL;
> END;
>
> --
> Rastko Potocnik
> rastko.potocnik_at_rtvslo.si
>
>
>
>

Looks like your problem is the number of arguments isn't identical.

Hth,

Sybrand Bakker, Oracle DBA Received on Wed Nov 22 2000 - 12:18:39 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US