-1

I am new to Functions as a service. I have done all the relavant setup and get below output for command command : fn invoke helloworld-app helloworld-func Output: Hello, world!

Now I need to invoke the helloworld-func using java client code which can run on any location. Is it possible ? If yes how ?

vinit saha
  • 47
  • 3

1 Answers1

1

In Oracle RDBMS you can compile a java source:

CREATE AND COMPILE JAVA SOURCE NAMED helloworld_app_source AS
public class helloworld_app {
  public static String helloworld_func()
  {
    return "Hello, world!";
  }
}

Then you can wrap it in an Oracle function:

CREATE FUNCTION helloworld_func RETURN VARCHAR2
AS LANGUAGE JAVA NAME 'helloworld_app.helloworld_func() return java.lang.String';
/

Then you can just call it in an normal SQL statement (as per any other function):

SELECT helloworld_func() FROM DUAL;

The Java function will run on the server but the query can be invoked from any SQL client connected to the server and will return the output to that client.

MT0
  • 143,790
  • 11
  • 59
  • 117