i Have a problem returning multiple rows in one output
there are multiple user_roleID’s returned. The procedure is below:
CREATE PROCEDURE Sample(OUT userName VARCHAR(30))
BEGIN
SELECT user_roleID INTO userName FROM users;
END
i would like to get a list of data when i print the output value (userName)
call Sample1(@emp);
select @emp;
but when i excecute this command i get the following error reported:
1172 – Result consisted of more than one row
Can somebody tell me how to fix this problem?
kind regards
If you are looking to create a stored function to return an ID based on a username, for example, then the following would work
This would be called using
SELECT Sample('SomeUserName') AS userID;