記錄拆花上shell

來源:互聯網
上載者:User

if [ -z "$1" ] ; then
echo "你沒有輸入執行該shell的參數"
exit;
fi

if [ "$1" != "jf" ] &&  [ "$1" != "jh" ] ; then
echo "請輸入要上傳的伺服器名稱:jf 經分,jh 稽核"
exit;
fi
CUR_YEAR=`date +"%Y"`

month=$(date "+%m"|sed '/^0/ s/0//')
permonth=`expr $month - 1`
month_len=`expr length $permonth`
if [ "$month_len" = "1" ]; then
v_month=0$permonth
elif [ "$month_len" = "2" ]; then
v_month=$permonth
elif [ "$permonth" = "0" ]; then
v_month=`12`
fi

LASTMONTH=${CUR_YEAR}${v_month}
#LASTMONTH=201202
#v_month="02"  
VALUE=`sqlplus -s chanxxxlzb/xxxx@chzzz<<EOF
set heading off;
set feedback off;
set pagesize 0;
set verify off;
set echo off;
select count(*)  from b_INFO_CLEAR_OWE where acct_month='${LASTMONTH}';
exit;
EOF`
echo "**************************";
echo $VALUE;
echo "**************************";

begin=1;
end=1000000;
file_seq=1;

temp=`expr $VALUE \% 1000000`
echo $temp
    
temp1=`expr $VALUE / 1000000`

if [ $temp -gt 0 ];  then
temp1=`expr $temp1 + 1`
fi

while [ $file_seq -le $temp1 ]
do
echo "第${file_seq}檔案"
strfile_seq_1=`printf "%03d\n" $temp1` 
strfile_seq_2=`printf "%03d\n" $file_seq`
strfile_seq=${strfile_seq_1}${strfile_seq_2}
echo ${strfile_seq}    ${begin} ${end}
if  [ "$1" = "jf" ]; then
  exp_month_jf execsql exp_month_clear_owe file_seq ${strfile_seq}  begin ${begin} end ${end}
elif [ "$1" = "jh" ]; then
  exp_month_jh execsql exp_month_clear_owe file_seq ${strfile_seq}  begin ${begin} end ${end}
fi
sleep 1
begin=`expr $begin + 1000000`
end=`expr $end + 1000000`
file_seq=`expr $file_seq + 1`
strfile_seq="";
done

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.