I have the next stored procedure:
DELIMITER $$
CREATE DEFINER=`root`@`localhost` PROCEDURE `getUserIdByLogin`(userId VARCHAR(255))
BEGIN
SELECT id FROM `userdata` WHERE login = userId;
END
I want to declare a new variable @tmp for e.g. and do smth to this:
SET @tmpValue = CALL getUserIdByLogin("someLogin");
But it doesn't work.
If just to call:
CALL getUserIdByLogin("someLogin");
Then I would see results, but I need to declare the results in the variable ( of array type ).
How can I do it?
Thanks!
CREATE DEFINER=`root`@`localhost` PROCEDURE `getUserIdByLogin`(
userId VARCHAR(255),
OUT idout int
)
BEGIN
SELECT id INTO idout FROM `userdata` WHERE login = userId;
END
then
SET @id = 0;
CALL getUserIdByLogin("someLogin", @id);
SELECT @id;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With