第一步:创建java source
create or replace and compile java source named Hello as
public class Hello
{
public static void run()
{
System.out.println("hello world!!");
}
}
第二步:编辑存储过程
create or replace procedure P_RUN_HELLO
as language java
name 'Hello.run()';
第三步:设置pl sql pluse
SQL> set serveroutput on size 5000;
SQL> call dbms_java.set_output(5000);
Method called
第四步:运行存储过程
SQL> EXEC P_RUN_HELLO;
hello world!!
PL/SQL procedure successfully completed
SQL