I’m using MariaDB version 10.3.28-MariaDB-cll-lve
This site https://mariadb.com/kb/en/user-defined-variables/ says
User-defined variables names must be preceded by a single at character (@)
That’s what I usually do but recently I was rushing, forgot the ‘@ and wrote the following function which seems to work fine without the variables having ‘@’ at the front.
So is having a ‘@’ in front of a user defined variable a firm requirement or not?
If it is, why does my function work correctly without it?
DELIMITER $$ CREATE FUNCTION get_next_redacted_member_id() RETURNS INT(11) BEGIN DECLARE result INT SIGNED; DECLARE lastid INT; INSERT INTO redacted_member_id ( date_used) VALUES ( NOW() ); SET lastid = (SELECT LAST_INSERT_ID() ); SET result = -1 * lastid ; RETURN result; END$$ DELIMITER ;