CREATE PROCEDURE GenerateToken(v_email varchar(255))
BEGIN
DECLARE i_count INT;
SELECT COUNT(email) INTO i_count
FROM tbToken WHERE email = v_email;
IF (i_count > 0) THEN
UPDATE tblToken
SET token = UUID(),
created_date = NOW()
WHERE email = v_email;
ELSE
INSERT INTO tblToken(email, token, created_date)
VALUES(v_email, UUID(), NOW());
END IF;
END;
Sunday, December 20, 2009
Generate token procedure
at 9:29 PM
Labels: MySQL, MySQL Query
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment