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

Home -> Community -> Usenet -> c.d.o.misc -> Re: simple java stored function doesn't work

Re: simple java stored function doesn't work

From: Vladimir M. Zakharychev <bob--nospam--_at_dynamicpsp.com>
Date: Fri, 26 May 2006 16:47:56 +0400
Message-ID: <e56tdv$26vj$1@hypnos.nordnet.ru>

"kostakis" <kostakis_at_poczta.onet.pl> wrote in message news:1148645030.641715.128880_at_i40g2000cwc.googlegroups.com...
> Hello,
>
> I try to create very simple java function in my oracle 9i. The java
> source is:
>
> CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED "Klasa" AS
> public class Klasa {
> public static int getInt(int in_in) {
> return(in_in);
> }
> };
> /
> This soruce compiles without any errors. I created also function:
>
> CREATE OR REPLACE function klasa_getint return number as language java
> name 'Klasa.getInt(int) return int';
> /
> which compiles without errors also.
>
> But when i invoke:
> select klasa_getint(5) from dual
> i become error:
> ORA-06553: PLS-306: wrong number or types of arguments in call to
> 'KLASA_GETINT'
>
> Why is that?
>

Obviously because

CREATE OR REPLACE function klasa_getint return number as language java

misses input argument specification. It should read

CREATE OR REPLACE function klasa_getint
( in_in IN NUMBER ) -- you need to declare input argument! return number as language java
...

-- 
   Vladimir M. Zakharychev
   N-Networks, makers of Dynamic PSP(tm)
   http://www.dynamicpsp.com 
Received on Fri May 26 2006 - 07:47:56 CDT

Original text of this message

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