I have a java procedure inside a package in Oracle:
procedure pREPORTTEHMOG_java(dName varchar2, dFrame number, dSlot number, dPort number) AS LANGUAGE java NAME 'REPORTTEHMOG_TEST.dovuciREPORTTEHMOG_TEST(java.lang.String,int,int,int)';
and it is defined something like this:
CREATE OR REPLACE AND RESOLVE JAVA SOURCE NAMED WIS."REPORTTEHMOG_TEST" AS import java.sql.*; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Calendar; public class REPORTTEHMOG_TEST { ... public static void dovuciREPORTTEHMOG_TEST(String dName, Integer dFrame, Integer dSlot, Integer dPort) throws Exception { ... } ... }
When I try to call the procedure like this:
declare begin REPORT_TEHMOG.pREPORTTEHMOG_java('MA5818_Caic', 0, 1, 1); end;
it throws an error:
ORA-29531: no method dovuciREPORTTEHMOG_TEST in class REPORTTEHMOG_TEST
Does anybody know the problem?
Advertisement
Answer
The int
primitive and the Integer
class are not the same thing, so your declaration does not match the Java method. It should be:
procedure pREPORTTEHMOG_java(dName varchar2, dFrame number, dSlot number, dPort number) AS LANGUAGE java NAME 'REPORTTEHMOG_TEST.dovuciREPORTTEHMOG_TEST(java.lang.String,java.lang.Integer,java.lang.Integer,java.lang.Integer)';
Or make the Java arguments int
if that is appropriate.