Mysql update statement not working

Here is my procedure code. I am trying to update Username by putting the old username in where clause.but, but it does not work.

 DELIMITER $$

    DROP PROCEDURE IF EXISTS `databasename`.`UpdateUsername` $$

    CREATE DEFINER=`root`@`localhost` PROCEDURE `UpdateUsername`
(IN  uname   VARCHAR(30),tid  VARCHAR(100),username VARCHAR(30)  )

BEGIN



UPDATE table_name SET Username=username WHERE Username=uname;

END $$ 
DELIMITER ;

please help me fix this problem.

+5
source share
3 answers

Try removing the "username" from line number "6" and use a different parameter name. This may be inconsistent with the user field of the table. For instance:UPDATE table_name SET Username=OTHER_PARAMETER_NAME WHERE Username=uname;

+2
source

If tid is the name of the table, should you not use tid instead of table_name in the update request?

0
source

, ,

UPDATE table_name  tn SET tn.Username=username WHERE tn.Username=uname;

:

update file_structure fs set fs.active_status = 'N' where fs.fileid = temp_fileid and fs.appid = temp_appid; 
0

All Articles