#!/bin/bash
#测试环境变量的引入
if [ -f /usr/local/tdneusoft/ORACLE_bill.profile ];then
. /usr/local/tdneusoft/ORACLE_bill.profile
fi
#引入系统环境变量
if [ -f/usr/local/tdneusoft/Runtime_32bit.profile ];then
. /usr/local/tdneusoft/Runtime_64bit.profile
fi
#引入用户的环境变量
sys=`uname`
if [ "$sys" == "Linux" ];then
if [ -f~/.bash_profile ];then
. ~/.bash_profile
fi
else
if [ -f~/.profile ];then
. ~/.profile
fi
fi
#加载环境变量
#创建文件存放目录
if [ ! -d $RUN_DIR/data/test ];then
mkdir -p $RUN_DIR/data/test
fi
sqlplus -s $USERNAME/$PASSWD@$SID<<! > /dev/null
set echo off;
set feedback off;
set heading off;
set trimspool on;
set termout off;
set newpage 0;
set num 18;
set pagesize 0;
set linesize 3000;
spool $RUN_DIR/data/test/testfile_${yyyymmdd}.txt
select to_char(operate_date, 'yyyymmdd')
||'|'||
count(operate_date)
||'|'||
sum(pay_fee)*100
from bf_ppc_pay_fee_t
where operate_date < sysdate and operate_date > (sysdate - 2) and to_char(operate_date, 'yyyymmdd') = to_char(sysdate - 1, 'yyyymmdd') group by to_char(operate_date, 'yyyymmdd');
select flow_number
||'|'||
to_char(date, 'yyyymmddhh24miss')
||'|'||
fee*100
from test_table
where date < sysdate and date > (sysdate - 2) and to_char(date, 'yyyymmdd') = to_char(sysdate - 1, 'yyyymmdd');
spool off;
exit
!
#测试环境变量的引入
if [ -f /usr/local/tdneusoft/ORACLE_bill.profile ];then
. /usr/local/tdneusoft/ORACLE_bill.profile
fi
#引入系统环境变量
if [ -f/usr/local/tdneusoft/Runtime_32bit.profile ];then
. /usr/local/tdneusoft/Runtime_64bit.profile
fi
#引入用户的环境变量
sys=`uname`
if [ "$sys" == "Linux" ];then
if [ -f~/.bash_profile ];then
. ~/.bash_profile
fi
else
if [ -f~/.profile ];then
. ~/.profile
fi
fi
#加载环境变量
export RUN_DIR
#加载配置文件
#取yyyymmdd格式的年月日
#创建文件存放目录
if [ ! -d $RUN_DIR/data/test ];then
mkdir -p $RUN_DIR/data/test
fi
sqlplus -s $USERNAME/$PASSWD@$SID<<! > /dev/null
set echo off;
set feedback off;
set heading off;
set trimspool on;
set termout off;
set newpage 0;
set num 18;
set pagesize 0;
set linesize 3000;
spool $RUN_DIR/data/test/testfile_${yyyymmdd}.txt
select to_char(operate_date, 'yyyymmdd')
||'|'||
count(operate_date)
||'|'||
sum(pay_fee)*100
from bf_ppc_pay_fee_t
where operate_date < sysdate and operate_date > (sysdate - 2) and to_char(operate_date, 'yyyymmdd') = to_char(sysdate - 1, 'yyyymmdd') group by to_char(operate_date, 'yyyymmdd');
select flow_number
||'|'||
to_char(date, 'yyyymmddhh24miss')
||'|'||
fee*100
from test_table
where date < sysdate and date > (sysdate - 2) and to_char(date, 'yyyymmdd') = to_char(sysdate - 1, 'yyyymmdd');
spool off;
exit
!