创建存储过程--get_jobname
create or replace procedure get_jobname(v_jobid in varchar2,v_jobname out varchar2)
as
begin
select job_name into v_jobname from schedule_job where job_id = v_jobid; --变量赋值
end get_jobname;
java调用存储过程
public static void main(String[] args) {
Connection conn=JdbcTool.getConnByJdbc();
String pro_param="26D9542B27A8663CE0531480140ABFE4";
String procedure="{call get_jobname(?,?)}";
try {
CallableStatement cs=conn.prepareCall(procedure);
cs.setString(1, pro_param);
cs.registerOutParameter(2, oracle.jdbc.OracleTypes.VARCHAR);
cs.execute();
String outpara=(String) cs.getObject(2);
System.out.println(outpara);
}catch (Exception e) {
e.printStackTrace();
}finally{
JdbcTool.closeConnection(conn);
}
}