> We're working with an overloaded Oracle supplied function.
maybe a wrapper function could be a solution for the problem, see example below.
Regards,
Jaromir D.B. Nemec
--- usage of a wrapper function to workaround overloaded function problem SQL> @(protected) SQL> --- SQL> CREATE or replace PACKAGE p IS 2 FUNCTION foo (arg1 varchar2) RETURN varchar2; 3 FUNCTION foo (arg2 varchar2) RETURN varchar2; 4 END; 5 /
Package created.
SQL> CREATE or replace PACKAGE BODY p IS 2 FUNCTION foo (arg1 varchar2) RETURN varchar2 IS BEGIN RETURN 'Hello arg1'; END; 3 FUNCTION foo (arg2 varchar2) RETURN varchar2 IS BEGIN RETURN 'Hello arg2'; END; 4 END; 5 /
Package body created.
SQL> -- this fails SQL> select p.foo(0) from dual; select p.foo(0) from dual * ERROR at line 1: ORA-06553 (See ORA-06553.ora-code.com): PLS-307: too many declarations of 'FOO' match this call
SQL> -- SQL> create or replace function wrap(a varchar2, b varchar2) return varchar 2 is 3 begin 4 if b is null 5 then return p.foo(arg1=>a); 6 else return p.foo(arg2=>b); end if; 7 end; 8 /
Function created.
SQL> -- but this is OK SQL> select wrap(NULL,'x') from dual;