MySQL Forums
Forum List  »  Stored Procedures

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');

Options: ReplyQuote


Subject
Views
Written By
Posted
stored procedure adds empty fields when creating new user
592
February 09, 2022 01:46PM


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.