Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update Statement in mysql procedure in not working

Here is my procedure code. I am trying to update Username by putting old username in where clause.but it doesn't 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 to FIX this problem.

like image 236
naveed Avatar asked Nov 04 '22 05:11

naveed


1 Answers

Try to remove 'username' from line number '6' and use some other parameter name. It might be conflicting with your table Username field. For example: UPDATE table_name SET Username=OTHER_PARAMETER_NAME WHERE Username=uname;

like image 176
shabbir.rang Avatar answered Nov 10 '22 07:11

shabbir.rang