在Java里调用sqlplus执行sql脚本:
for(Iterator keyIt = listSqlName.iterator();keyIt.hasNext();){
String sqlName = (String)keyIt.next();
String cmd="sqlplus userName/pwd@sid @sqlName > sqllog_dir";
try{
Process pr = Runtime.getRuntime().exec(cmd);
pr.waitFor();
}catch(IOException e) {
e.printStackTrace();
}
}
因为pr.waitFor(),它不往下执行了,而这个是循环执行多个sql文件,应该怎么写呢?
for(Iterator keyIt = listSqlName.iterator();keyIt.hasNext();){
String sqlName = (String)keyIt.next();
String cmd="sqlplus userName/pwd@sid @sqlName > sqllog_dir";
try{
Process pr = Runtime.getRuntime().exec(cmd);
pr.waitFor();
}catch(IOException e) {
e.printStackTrace();
}
}
因为pr.waitFor(),它不往下执行了,而这个是循环执行多个sql文件,应该怎么写呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货