I am trying to retrieve a field through a stored procedure, and I used the following query. I aimed to collect several rows, but it only succeeds when there is one row. Or it returns an error, as I mentioned below.
MYSQL query
delimiter ;; drop procedure if exists Sample1;; CREATE PROCEDURE Sample1(IN lft1 INT,IN rgt1 INT, OUT emp1 VARCHAR(20)) BEGIN SELECT p.emp into emp1 FROM personnell p WHERE p.lft>lft1 and p.rgt < rgt1 LIMIT 10; END;; call Sample1(1,10,@emp);; select @emp;
Error message
MySQL said: Documentation
Note
----- Sample1--- procedure name; emp -----selected field from table personnell lft -----use to check the condition,it is also one of the field of table personnell personnell------table name
source share