I am trying to figure out how to throw an error with formatted error message in MySQL (5.7).
// SOME PROCEDURE
begin
declare something INT;
start transaction;
call getsomething(something); // sets something to data
if something is NULL then
rollback;
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'Something %d not found!', MYSQL_ERRNO = 1001;
end if;
commit;
end
How can I use "something" variable when creating error message?