Creating Java Stored Procedures

Create Java stored procedures by first developing business application logic in a Java class file. Declare methods that are to become stored procedures as public static.

Use the code editor in JDeveloper to add and edit business logic in the Java class. During deployment to Oracle Database, all public static methods included in the class file are available to be published to PL/SQL as stored procedures. You can choose which public static methods in the class to be published to PL/SQL.

There are different JDeveloper Java stored procedure creation scenarios:

For example, assume the following Java package Welcome was created with the public class Greeting and the public static method Hello().


package Welcome;

  public class Greeting {

    public static String Hello() {

      return "Hello World!";

    }

  }

    

When this package, Welcome, is deployed to Oracle Database and the Hello() method is published there, the call spec for the package as viewed in the JDeveloper Database Browser looks like this:


PACKAGE WELCOME AS

FUNCTION HELLO RETURN VARCHAR2

AS LANGUAGE JAVA

NAME 'Welcome.Greeting.Hello() return java.lang.String'

END WELCOME;

    

Improving Performance with Java Stored Procedures
Deploying Java Stored Procedures
About Java Stored Procedures

 

Copyright © 1997, 2004, Oracle. All rights reserved.