17,086
社区成员
发帖
与我相关
我的任务
分享
update A set name=name||'bb'
commit;
create or replace procedure PR_QianFeiQingDan
(
s_st in varchar(2),
s_tjfs in varchar(5),
s_YM in varchar(6)
)
is
BEGIN
orderCondition varchar(128);
joinCondition varchar(128);
field varchar(30);
condition varchar(128);
sql varchar(4000);
ym varchar(32);
zhandian varchar(32);
condition:='';
joinCondition:='';
if nvl(s_YM,'')='' then
begin
s_YM:=to_char(sysdate,'yyyymm');
end
end if;
if nvl(s_st,'')='' then
begin
s_st:='00';
end
end if;
if s_st<>'00' then
begin
condition:=condition+' and a.s_st='''+s_st+'''';
end
end if;
if s_tjfs='0' then--收费方式
begin
field:=',S_ShouFeiMC s_sffs';
orderCondition:='order by S_ShouFeiMC';
joinCondition:=' left join KG_YongHuSFFS c on a.i_sffs=c.I_ShouFeiBH ';
end
end if;
if s_tjfs='1' then--用水性质
begin
field:=',S_FeiLeiMC s_sffs';
orderCondition:='order by S_FeiLeiMC';
joinCondition:=' left join JG_YongShuiFL c on a.I_JH=c.I_JH and a.I_TJH=c.I_TiaoJiaH ';
end
end if;
if s_tjfs='2' then--册本
begin
field:=',S_CH s_sffs';
orderCondition:='order by S_CH';
end
end if;
if s_tjfs='3' then--抄表员
begin
field:=',Name s_sffs';
orderCondition:='order by Name';
joinCondition:=' left join kg_cebenxx c on a.S_Ch=c.S_Ch
left join CB_ChaoBiaoYXX e on S_ChaoBiaoYBH=e.S_YuanGongBH';
end
end if;
ym:=substr(s_YM,1,4)+'年'+substr(5,2)+'月'
sql:=' select a.s_cid'+field+'
,a.s_hm
,a.s_dz
,(i_y*100+i_m) ym
,a.n_je,a.N_YingShouZNJ,b.S_LianXiDH
,nvl(a.n_je,0) count
,'''+ym+''' time
, case when S_ZhanDianMC is null then ''供水总公司'' else S_ZhanDianMC end st
,row_number() over('+orderCondition+') id
,case '+s_tjfs+' when 0 then ''收费方式'' when 1 then ''用水性质''
when 2 then ''册本号'' else ''抄表员'' end ''tjfs''
from zw_yingyez a
left join kg_kehuxx b on a.s_cid=b.s_cid '+joinCondition+'
left join sx_zhandianxx d on d.s_st='+s_st+'
where a.i_jlzt=0 and a.N_JE>0 and i_xiaozhang=0 and (i_y*100+i_m)='+s_YM+''+condition
execute sql
END
update tb set name=name||'bb'
执行完提交下 不然会回滚的记录还是跟以前没改的一样
记得 commit;