創建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...");
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章