Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- drop procedure if exists Payments;
- delimiter |
- create procedure monthlyTaxPayment(in accountID int, in taxAmount double)
- begin
- start transaction;
- update accounts set amount = amount - taxAmount where accounts.id =
- accountID;
- if((select amount from accounts where accounts.id=accountID)<0)
- THEN
- begin
- insert into debtors
- select customer_id from accounts
- where accounts.id=accountID;
- rollback;
- end;
- else
- begin
- set result = 1;
- commit;
- end;
- end if;
- end;
- |
- delimiter ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement