sql脚本:
sql语句 导数据脚本:(chkdata.sh ) $ORACLE_HOME/bin/sqlplus tran/password@gfg <<! --set time on --set timing on set echo off@chkbilldev.sql
exit;
sqlldr入库脚本:
chkdata.sh > chk.log
cat chk.log |awk '{if($2 ~/[0-9]/) printf("%-10s%-40s%-10s/n",$1,$3,$2) }' > datafile.dat sqlplus tran/password@gfg<<EOF
truncate table acct.chk_tab_hn_ucj;
exit EOF
dirname=`pwd`
filename=$dirname/datafile.dat >datafile.ctl
echo "LOAD DATA" >> datafile.ctl
echo INFILE "'"$filename"'">>datafile.ctl
echo "Append INTO TABLE acct.chk_tab_hn_ucj" >>datafile.ctl
echo "(name position(1:10) ," >> datafile.ctl
echo "tablename position(11:50) ," >> datafile.ctl echo "num position(51:60) ) " >> datafile.ctl
sqlldr tran/password@gfg control=datafile.ctl rows=1000