shell查询数据生成文件到指定路径

###############################
CONN_SALE=库名/密码@服务名
echo "======================================================================="
###############################
# 2.data export #
###############################
#cd ${DataPath}
DEALDATEDay=`date -d"-1 day" +%Y%m%d`"_1库.csv"
filename=${DEALDATEDay}
sqlplus -s $CONN_SALE <<EOF
set echo off;
set feedback off;
set heading off
set pagesize 0;
set linesize 7000;
set termout off;
set trimout on;
set trimspool on;
spool  /bss/sale1/filecenter_in/test_info/${filename}
select '省份'||','||'地市'||' from dual;
spool off;
exit;
EOF
 

猜你喜欢

转载自lihong11.iteye.com/blog/2289345