ORACLE创建Java过程
STEP1:
CREATE OR REPLACE JAVA SOURCE NAMED "Employee" AS
import java.sql.*;
import oracle.jdbc.*;
public class Employee{
public static void getItEmps(){
Connection conn = null;
PreparedStatement pst = null;
ResultSet rs = null;
try{
conn = DriverManager.getConnection("jdbc:default:connection:");
String sql = "select * from sys.employee where e_id > 1000";
pst = conn.prepareStatement(sql);
rs = pst.executeQuery();
while(rs.next()){
System.out.println(rs.getString(1) + "\t" + rs.getString(2));
}
}catch(Exception e){
System.err.println(e);
}finally{
try{
rs.close();
pst.close();
conn.close();
}catch(Exception e){
System.err.println(e);
}
}
}
}
STEP2:
create or replace procedure get_it_emps AS LANGUAGE JAVA NAME ‘Employee.getItEmps()‘;
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。