I'm trying to call a procedure, but casting the argument, but even performing the casting, the received argument is still the old type.
My procedure:
CREATE PROCEDURE transfer_money(
user_origin_id int,
user_destination_id int,
amount dec
)
LANGUAGE sql
AS $delimiter$
DECLARE
wallet_origin_id integer,
wallet_destination_id integer;
BEGIN
SELECT wallet_id INTO wallet_origin_id
FROM users
WHERE id = user_origin_id;
SELECT wallet_id INTO wallet_destination_id
FROM users
WHERE id = user_destination_id;
UPDATE wallets
SET balance = balance - amount
WHERE id = wallet_origin_id;
UPDATE wallets
SET balance = balance + amount
WHERE id = wallet_destination_id;
commit;
END;
$delimiter$
My call:
CALL transfer_money(1, 2, cast(100.00 as DECIMAL));
Error:
ERROR: procedure transfer_money(integer, integer, numeric) does not exist
LINE 1: CALL transfer_money(1, 2, cast(100.00 as DECIMAL));
^
HINT: No procedure matches the given name and argument types. You might need to add explicit type casts.
SQL state: 42883
Character: 6