Вопрос

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