insert into tp_tradedata_error_01 --tac错误(灰记录)公交消费数据入中间表
select id,rectype,tradetype,asn,posno,samno,postradeno,
tradedate,tradetime,premoney,trademoney,
smoney,psamverno,cardtradeno,tac,cityno,
callingno,corpno,subcityno,departno,mac,
collectcardno,instime,tacstate,macstate,
batchno,'1','0'
from ti_tradedata_01
where (tacstate = '1' or macstate = '1') and rectype = '1' --1表示灰记录
and cityno = '2150'
if @@error <> 0 --TAC错误(灰记录)消费数据入中间表失败
begin
rollback
return 3
end
---------------------------------------------------------------------------------------------
insert into tp_tradedata_error_01 --公交消费测试数据入中间表
select id,rectype,tradetype,asn,posno,samno,postradeno,
tradedate,tradetime,premoney,trademoney,
smoney,psamverno,cardtradeno,tac,cityno,
callingno,corpno,subcityno,departno,mac,
collectcardno,instime,tacstate,macstate,
batchno,'5','0'
from ti_tradedata_01 a
where tacstate = '0' and macstate = '0' and cityno = '2150' and
not exists (select 1 from tf_r_icuser b where b.asn = a.asn)
if @@error <> 0 --公交消费测试数据入中间表失败
begin
rollback
return 4身略了很多
select id,rectype,tradetype,asn,posno,samno,postradeno,
tradedate,tradetime,premoney,trademoney,
smoney,psamverno,cardtradeno,tac,cityno,
callingno,corpno,subcityno,departno,mac,
collectcardno,instime,tacstate,macstate,
batchno,'1','0'
from ti_tradedata_01
where (tacstate = '1' or macstate = '1') and rectype = '1' --1表示灰记录
and cityno = '2150'
if @@error <> 0 --TAC错误(灰记录)消费数据入中间表失败
begin
rollback
return 3
end
---------------------------------------------------------------------------------------------
insert into tp_tradedata_error_01 --公交消费测试数据入中间表
select id,rectype,tradetype,asn,posno,samno,postradeno,
tradedate,tradetime,premoney,trademoney,
smoney,psamverno,cardtradeno,tac,cityno,
callingno,corpno,subcityno,departno,mac,
collectcardno,instime,tacstate,macstate,
batchno,'5','0'
from ti_tradedata_01 a
where tacstate = '0' and macstate = '0' and cityno = '2150' and
not exists (select 1 from tf_r_icuser b where b.asn = a.asn)
if @@error <> 0 --公交消费测试数据入中间表失败
begin
rollback
return 4身略了很多
create proc p_process
@re int out --返回处理的结果,0为正确,其他为出错的编号
as
begin tran
处理语句1
if @@error<>0
begin
set @re=1
goto lb_re
end 处理语句2
if @@error<>0
begin
set @re=2
goto lb_re
end
处理语句3
if @@error<>0
begin
set @re=3
goto lb_re
end
commit tran
returnlb_re:
rollback tran
go--调用:
declare @re int
exec p_process,@re out
select 结果=@re
exec @iret = proc_name
这是就应该能得到啊,可是得到的确实系统的,不知何故?
另外我不想象楼上的兄弟一样勇output参数!