CREATE PROCEDURE `bank`.`withdraw` (accountId int, customerId int, amount double) BEGIN Declare var_balance double; Declare var_accountId int; Declare var_customerId int; Declare var_remainder double; select account.accountId, customer.customerId, account.balance into var_accountId, var_customerId, var_balance from customer, account where account.accountId = accountId and customer.customerId = customerId; if amount < var_balance then set var_remainder = account.balance - amount; END
if amount < var_balance then set var_remainder = account.balance - amount;
if amount < var_balance then set var_remainder = var_balance - amount; end if
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)