stored procedure adds empty fields when creating new user
Posted by:
badr douah
Date: February 09, 2022 01:46PM
Hi,
i have a stored procedure that im testing inside mysqlworkbench, im getting new user created successfly after executing the SP but with empty values for username email HashPass and SaltPass,
any ideas what will be causing this
Ps: the stored procedure works perfectly if i don't use concat
here is
CREATE DEFINER=`admin`@`%` PROCEDURE `CreateUser`(IN dbName VARCHAR(50),IN UserName varchar(250),IN Email varchar(250),IN HashPass varchar(250),IN SaltPass varchar(250))
BEGIN
SET @_dbName = dbName;
SET @query = CONCAT('INSERT INTO ',@_dbName, '.Users (UserName,Email,HashPass,SaltPass,CreationDate)
VALUES(UserName, Email, HashPass, SaltPass, NOW());');
PREPARE stmt FROM @query;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
END
test
call ProjectsDB.CreateUser('kiwi', 'test', 'test@gmail.com', 'qsaaksjhaslja', 'jbkasakskajka');