📄 dopsit_d.sql
字号:
create procedure Deposit_t_d
@type varchar(50),
@Number char(15),
@date datetime,
@id char(6),
@TT char(10),
@amount float,
@riqi integer/*存款与透支之差*/
/*透支额小于存款额*/
as
begin transaction
update customer
set trust_abi=trust_abi-1
where customer_id=@id and @riqi>100 and trust_abi>=0
if @@Error<>0 goto PRO
update bank
set Asset=asset+@amount
where card_type=@type;
if @@Error<>0 goto PRO
delete
from overdraft
where card_type=@type and card_no=@Number
if @@Error<>0 goto PRO
update fund_bill
set fortune_amount=fortune_amount+fortune_amount*0.005*datediff(day,deposit_date,getdate())
where card_type=@type and card_no=@Number
if @@Error<>0 goto PRO
update fund_bill
set fortune_amount=fortune_amount+@amount,deposit_date=@date
where card_type=@type and card_no=@Number
if @@Error<>0 goto PRO
insert into fetch_Depo_log
values(@id,@type,@date,@amount,@TT)
if @@Error<>0 goto PRO
commit transaction
return 0
PRO:
Rollback Transaction
return 1
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -