| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> c.d.o.server -> Re: Publishing Java Stored Procedure
Avi Abrami wrote:
> 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.
OK, the problem was that this is a FUNCTION, since it returns a java.lang.String. Thank you very much for your help! Received on Tue Nov 21 2000 - 18:40:59 CST
![]() |
![]() |