shell和oracle交互下,怎么实现循环插入

[复制链接]
查看11 | 回复0 | 2012-9-12 19:30:59 | 显示全部楼层 |阅读模式
for day in ${days}
do
for tb in ${tables}
do
sqlplus **/** @ tmp.sql
echo "set feedback off;" >>tmp.sql
echo " whenever sqlerror exit sql.sqlcode" >>tmp.sql
for day in ${days}
do
for tb in ${tables}
do
echo "insert into M_REP_BACK_RECORD(TASK_ID,TABLE_TYPE,BACK_TABLE_NAME,TABLE_NUM,BACK_DATA_DATE,BACK_AREA,BACK_STATE,BACK_BE_TM) values(1,'2','${tb}','0','${day}','$1','0','${betime}');" >>tmp.sql
done
done
echo "commit;" >> tmp.sql
echo "exit;" >>tmp.sql
sqlplus ***/*** @tmp.sql
rm tmp.sql
exit 0;
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行