ת
来自「用dephi写的一个银行管理系统」· 代码 · 共 44 行
TXT
44 行
create procedure turn
@type1 varchar(50),
@type2 varchar(50),
@card_no1 char(13),
@card_no2 char(13),
@amount float,
@flag integer
as
begin transaction
/* 计算存款的利息*/
update fund_bill
set fortune_amount=fortune_amount+fortune_amount*0.005*(datediff(day,Deposit_date,getdate()))
where card_type=@type1 and card_no=@card_no1
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=@type2 and card_no=@card_no2
if @@Error<>0 goto pro
/* 转账*/
update fund_bill
set fortune_amount=fortune_amount-@amount-@amount*0.02,deposit_date=getdate()
where card_type=@type1 and card_no=@card_no1 and @flag=1
if @@Error<>0 goto pro
update fund_bill
set fortune_amount=fortune_amount-@amount-@amount*0.05,deposit_date=getdate()
where card_type=@type1 and card_no=@card_no1 and @flag=0
if @@Error<>0 goto pro
update fund_bill
set fortune_amount=fortune_amount+@amount,deposit_date=getdate()
where card_type=@type2 and card_no=@card_no2
if @@Error<>0 goto pro
commit transaction
return 0
pro:
Rollback Transaction
return 1
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?