Given the following Java which is loaded into the database using loadjava:
package grassie.example;
public class Example {
public static String test(){
return "Hello World!";
}
}
And given the following Oracle Stored Function:
CREATE OR REPLACE FUNCTION TEST_FUNCTION RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'grassie.example.Example.test() RETURN java.lang.String';
Why does the function not compile with the following error?:
Error(3,1): PLS-00311: the declaration of "grassie.example.Example.test() RETURN java.lang.String" is incomplete or malformed
Oracle client is 9.2.0.8.0, database is 9.2.0.8.0. Using SQL Developer 2.1.0.63
edit: Ammended my question based on answers below.
To further clarify, I created this simple test class and function because I am having problems with more complicated Java and stored functions, which accept and return various parameter types.
Get rid of the empty parentheses in the function declaration:
CREATE OR REPLACE FUNCTION TEST_FUNCTION RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'grassie.example.Example.test() RETURN java.lang.String';
Update:
Java
keywords should be lowercase. Try replacing RETURN
with return
in the NAME
clause.