转:https://blog.csdn.net/wangxw8746/article/details/9986415
1新建一个java source窗口
create or replace and compile java source named Hello as
public class Hello
{
public static void run()
{
System.out.println("hello world!!");
}
}
2新建一个sql windows窗口
create or replace procedure P_RUN_HELLO
as language java
name 'Hello.run()';
3新建一个command window窗口,依次执行以下语句
SQL> set serveroutput on size 5000;
SQL> call dbms_java.set_output(5000);
SQL> EXEC P_RUN_HELLO;
4运行结果
hello world!!
PL/SQL procedure successfully completed