The Java source text that makes up the body of a stored procedure is not a complete Java program, but a program fragment or snippet that the OpenEdge SQL Engine converts into a complete Java class when it processes a CREATE PROCEDURE statement. Creating a stored procedure involves the following steps:
1. A client application or tool issues a CREATE PROCEDURE statement that contains the Java source text.
2. The OpenEdge SQL Engine adds code to the Java snippet to create a complete Java class and submits the combined code to the Java compiler.
3. Presuming there are no compilation errors, the Java compiler returns compiled bytecode back to the OpenEdge SQL Engine. If there are compilation errors, the OpenEdge SQL Engine passes the first error message generated by the compiler back to the application or tool that issued the CREATE PROCEDURE statement.
4. The OpenEdge SQL Engine stores both the Java source text and the bytecode form of the procedure in the database.
The following figure illustrates the general steps for creating a Java stored procedure.