Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE PROCEDURE usp_calculate_future_value_for_account (account_id INT, interest_rate DECIMAL(19,4))
- BEGIN
- DECLARE future_value DECIMAL(19,4);
- DECLARE balance DECIMAL(19, 4);
- SET balance := (SELECT a.balance FROM accounts AS a WHERE a.id = account_id);
- SET future_value := balance * (POW((1 + interest_rate), 5));
- SELECT a.id AS account_id, ah.first_name, ah.last_name, a.balance, future_value
- FROM accounts AS a
- INNER JOIN account_holders AS ah
- ON a.account_holder_id = ah.id
- AND a.id = account_id;
- END;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement