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

Home -> Community -> Mailing Lists -> Oracle-L -> RE: association operator (=>) and SQL

RE: association operator (=>) and SQL

From: <Katz.C_at_forces.gc.ca>
Date: Mon, 18 Apr 2005 09:06:57 -0400
Message-Id: <20050418130400.91897114603@mx03.forces.gc.ca>


Jaromir,
That's a great solution.
thanks
chaim

-----Original Message-----
From: jaromir nemec [mailto:jaromir_at_db-nemec.com] Sent: Sunday, April 17, 2005 1:35 PM
To: Katz.C_at_forces.gc.ca; lex.de.haan_at_naturaljoin.nl Cc: oracle-l_at_freelists.org
Subject: Re: association operator (=>) and SQL

Hi chaim,

> 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

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: 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;

WRAP(NULL,'X')




Hello arg2

SQL> select wrap('x',NULL) from dual;

WRAP('X',NULL)




Hello arg1 Received on Mon Apr 18 2005 - 09:13:15 CDT

Original text of this message

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