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

Home -> Community -> Usenet -> c.d.o.server -> Re: Publishing Java Stored Procedure

Re: Publishing Java Stored Procedure

From: Avi Abrami <aabrami_at_intersystemsww.com>
Date: Tue, 21 Nov 2000 07:52:17 +0200
Message-ID: <3A1A0D91.79F00FF2@intersystemsww.com>

rfk wrote:

> I have a little java stored procedure that takes 2 java Strings and
> concatenates them together and returns them (just a test program). I am
> having trouble publishing it and was looking for some help.
>
> I have my code in FirstProcedure.java, on which I run 'loadjava'
> successfully:
> > loadjava -user icd/icds_at_system -r -f -v -oci8 FirstProcedure.java
> > initialization complete
> > loading : FirstProcedure
> > creating : FirstProcedure
> > resolver :
> > resolving : FirstProcedure
> >
>
> To check things:
> > 1 select object_name, object_type, status, timestamp
> > 2 from user_objects
> > 3* where object_name = 'FirstProcedure';
> >
> > OBJECT_NAME
> > ----------------------------------------------------------------------
 

> > OBJECT_TYPE STATUS TIMESTAMP
> > ------------------ ------- -------------------
> > FirstProcedure
> > JAVA CLASS VALID 2000-11-20:14:38:39
> >
> > FirstProcedure
> > JAVA SOURCE VALID 2000-11-20:14:38:38
>
> Now I try to publish it and get an error:
>
> SQL> create or replace procedure rfkconcat (s1 varchar2, s2 varchar2)
> 2 as language java
> 3 name 'FirstProcedure.Concat(java.lang.String, java.lang.String)
> 4 return java.lang.String';
>
> Warning: Procedure created with compilation errors.
>
> I don't understand what's the problem.
> Any suggestions are greatly appreciated.

Hi rfk,
Several things come to mind:

  1. If method 'Concat' returns something, then you need to create a stored FUNCTION and not a procedure.

       CREATE OR REPLACE FUNCTION rfkconcat

2. 'Concat' needs to be a static method of class

   'FirstProcedure'.

3. In your java source code, you may have to

   write 'java.lang.String' in the method header    (instead of just 'String').

      public static java.lang.String
             Concat(java.lang.String str1,
                    java.lang.String str2)

4. Getting more details about the error may help.

   You can "select * from user_errors" in Oracle,    or "show errors procedure 'RFKCONCAT'    (from SQL*Plus)

HTH,
Avi. Received on Mon Nov 20 2000 - 23:52:17 CST

Original text of this message

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