proc
drop procedure if exists get_user;
delimiter #
create procedure get_user
(
in p_user_id int unsigned,
in p_explain tinyint unsigned
)
begin
if (p_explain) then
explain select * from users where user_id = p_user_id;
end if;
select * from users where user_id = p_user_id;
end#
delimiter ;
call get_user(1,1);