Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Overloading package functions
Rastko Potocnik wrote in message ...
>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;
>
My guess is that because the second parameter of the first function is not mandatory a situation can occur at run-time in which the parameters are not different enough to decide which of the two functions should be called.
If you call TMP_OBJECT with only one parameter there is no way Oracle can know which version is required. Even if you use two parameters you will probably still get the PLS-00307 error.
Mia supozo estas ke char la dua parametro de la unua funkcio estas nedeviga, situacio povas okazi dum ekzekutado en kiu la parametroj ne estas sufiche diferencaj por decidi kiu de la du funkcioj devus esti alvokita.
Se vi alvokas TMP_OBJECT-on kun nur unu parametro Oracle neniel povas scii kiu versio estas postulata. Ech se vi uzas du parametrojn vi vershajne ankorau ricevos la PLS-00307-eraron.
Gerard van Wilgen Received on Mon Nov 27 2000 - 07:42:43 CST
![]() |
![]() |