欢迎光临
我们一直在努力

Oracle Java Stored Procedure + 包调用

1. 创建Java Stored Procedure

create or replace and compile java source named "TestHello" as
public class TestHello{
  public static void test(){
    System.out.println("Hello");
  }
}

2.创建JSP调用存过或方法(本例为在包创建的存过)

create or replace package pkg_test is
  procedure do_Test;
end pkg_test;
/
create or replace package body pkg_test is
  procedure do_Test as language java name 'TestHello.test()';
begin
  null;
end pkg_test;
/

3.在命令窗口调用,通过如下命令使System.out重定向到当前窗口

SQL> set serveroutput on
SQL> call dbms_java.set_output(5000);
Method called
SQL> exec pkg_test.do_Test;
Hello
PL/SQL procedure successfully completed

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。