MySQL Forums
Forum List  »  Stored Procedures

MySQL Procedure SELECT statement not working
Posted by: Dale Picou, Jr.
Date: May 05, 2014 08:15PM

I current have this stored procedure. It works fine when nothing else is in the users table but the SELECT statement returns multiple rows when there is more than one user entry. Why is this happening?

DELIMITER $$

CREATE PROCEDURE CreateUser(IN EmailAddress VARCHAR(45),IN FirstName VARCHAR(45),IN LastName VARCHAR(45),IN ActivationToken VARCHAR(40))
BEGIN
DECLARE UserID INT;
INSERT INTO `users` (`EmailAddress`, `Password`, `AccountType`) VALUES (EmailAddress, 'none', '2');
SELECT `ID` INTO UserID FROM `users` WHERE `EmailAddress`=EmailAddress;
UPDATE `user_info` SET `LastName`=LastName, `FirstName`=FirstName WHERE `ID`=UserID;
UPDATE `user_activation` SET `ActivationCode`=ActivationToken;
END

Options: ReplyQuote


Subject
Views
Written By
Posted
MySQL Procedure SELECT statement not working
2463
May 05, 2014 08:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.