创建Job执行过程程序笔记

public void executeProc(int procId,String param) throws InvalidRowColException, ColumnTypeNotMatchException, IOException, SQLException {

String sql = "select t.proc_name_eng procName from dw.dw_proc_manger t where t.proc_id = " +procId;
Datastore ds = dc.retrieve(sql);
String procName = ds.getItemString(1, "procName");

StringBuffer exeSql = new StringBuffer();
exeSql.append("DECLARE X NUMBER;BEGIN SYS.DBMS_JOB.SUBMIT( job => X,what => '");
exeSql.append(procName);
exeSql.append("(''"+param+"'');',next_date => sysdate,no_parse => FALSE);END;");
   
log4j.info(exeSql);
Connection conn = null;
Statement stmt = null;
try{
conn = JDBCUtil.getConnection();
stmt = conn.createStatement();
int flag = stmt.executeUpdate(exeSql.toString());
conn.commit();
log4j.info("flag:"+flag);
}finally{
if (stmt != null) {
stmt.close();
}
if (conn != null) {
conn.close();
}
}

log4j.info("execute success...");
}

你可能感兴趣的:(sql,log4j)