Answer the question
In order to leave comments, you need to log in
How to use the result of a stored procedure in a query?
Good afternoon. My question is completely noob but can't find an answer. I would be glad if you poke your nose into the right section of the documentation.
There is a basis in which there is a stored procedure.
CREATE DEFINER=`root`@`localhost` PROCEDURE `enum_id`(IN `start_id` INT, IN `end_id` INT)
NOT DETERMINISTIC CONTAINS SQL SQL SECURITY DEFINER
BEGIN
DECLARE current_id INT;
create temporary table id_list (
`id` INT NOT NULL
);
SET current_id = start_id;
WHILE current_id <= end_id DO
INSERT INTO id_list (`id`) VALUES (current_id);
SET current_id = current_id + 1;
END WHILE;
select * from id_list;
END
SELECT * FROM (`enum_id`(0, 100)) `t` JOIN `enity` ON `t`.`id`=`entity`.`id`;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question