说明:
在oracle将sjkk_gcjl表中的2000W数据复制到sjkk_gcjl_data
采用的分页插入的方式,每次插入1000条。
#!/bin/sh
a=0
for ((i=0;i<1000000;i+=1000))
do
a=`expr $i + 1000`
echo "i=$i"
echo "a=$a"
sqlplus -S /nolog << EOF
CONNECT VIEWALL/VIEWALL
insert into sjkk_gcjl_data
SELECT JLBH,HPHM,HPZL,JGSJ,XSZT,CLSD,CDFX,CWKC,HPYS,CLLX,XZQH,SBBH,CDBH,CSYS,CLPP,TPLX,TZTP,QJTP,RKSJ,YZSJ,SJCZ,YLZD1,YLZD2,YLZD3,YLZD4,YLZD
5
FROM (SELECT ROWNUM AS rowno, t.*
FROM sjkk_gcjl t
WHERE jgsj BETWEEN TO_DATE ('20140701', 'yyyymmdd')
AND TO_DATE ('20140801', 'yyyymmdd')
AND ROWNUM <= $a) table_alias
WHERE table_alias.rowno >= $i;
select count(1) from sjkk_gcjl_data;
EXIT;
EOF
done
阅读(2130) | 评论(0) | 转发(0) |