-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 ?

1
  • What's the role of Oracle in this scenario? Commented Mar 9, 2020 at 11:41

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.