需求
将文件V_FEE_DSSITF.sql中标红的部分替换为小写,其它内容不变。
CREATE OR REPLACE FORCE NONEDITIONABLE VIEW "CFPS7_CGO_TEST"."V_FEE_DSSITF" ("BILLID", "STOCKTYPEID", "STOCKPRE", "STOCKNO", "FEENM", "AIRPORTID", "FEE", "FEETIME", "FEEDELFLAG") AS
select billid, stocktypeid, stockpre, stockno, feenm,airportid, sum(fee) as fee,feetime,feedelflag
from (select vfee.stocktypeid,
vfee.stockpre,
vfee.stockno,
vfee.billid,
usrope.airportid,
case
when (vfee.feeshortnm like '%fee1%' or vfee.feeshortnm like '%fee2%') Then
'store'
when (vfee.feeshortnm like '%fee1%' or vfee.feeshortnm like '%fee2%') Then
'deal'
when vfee.feeshortnm like '%fee3%' Then
'ext'
Else
'other'
end feenm,
nvl(vfee.fee,0) fee,
vfee.feecrtopetime feetime,
decode(vfee.feedelopetime,null,'N','Y') feedelflag
from v_fee_fee vfee,t_usr_opedepart usrope
where vfee.feeopedepartid=usrope.opedepartid
order by vfee.billid, vfee.feeshortnm)
group by billid, stocktypeid, stockpre, stockno, feenm,airportid,feetime,feedelflag
order by feedelflag desc,billid, feenm;
操作命令
#sed 's/\"CFPS7_CGO_TEST\".\"[A-Z_]*\"/\L&/g' V_FEE_DSSITF.sql
输出结果
CREATE OR REPLACE FORCE NONEDITIONABLE VIEW "cfps7_cgo_test"."v_fee_dssitf" ("BILLID", "STOCKTYPEID", "STOCKPRE", "STOCKNO", "FEENM", "AIRPORTID", "FEE", "FEETIME", "FEEDELFLAG") AS
select billid, stocktypeid, stockpre, stockno, feenm,airportid, sum(fee) as fee,feetime,feedelflag
from (select vfee.stocktypeid,
vfee.stockpre,
vfee.stockno,
vfee.billid,
usrope.airportid,
case
when (vfee.feeshortnm like '%fee1%' or vfee.feeshortnm like '%fee2%') Then
'store'
when (vfee.feeshortnm like '%fee1%' or vfee.feeshortnm like '%fee2%') Then
'deal'
when vfee.feeshortnm like '%fee3%' Then
'ext'
Else
'other'
end feenm,
nvl(vfee.fee,0) fee,
vfee.feecrtopetime feetime,
decode(vfee.feedelopetime,null,'N','Y') feedelflag
from v_fee_fee vfee,t_usr_opedepart usrope
where vfee.feeopedepartid=usrope.opedepartid
order by vfee.billid, vfee.feeshortnm)
group by billid, stocktypeid, stockpre, stockno, feenm,airportid,feetime,feedelflag
order by feedelflag desc,billid, feenm;