문제

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.

도움이 되었습니까?

해결책

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;

다른 팁

If tid is the table name, shouldn't you use tid instead of table_name in the update query?

Hi i have faced same issue give an alise to table name and try running update query

try this query

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

the query i have used is :

update file_structure fs set fs.active_status = 'N' where fs.fileid = temp_fileid and fs.appid = temp_appid; 
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top