I have wrote mysql query to update column using mysql variable. Actually I'm want to create the function, execute it and then drop the function for below query. I'm really new to mysql Function, Can some please help me to covert query into mySQL Function.
SET @user_id = 1;
SET @user_employee_id_new = '87847894';
SET @user_employee_id_old = '35345642';
select * from `user` WHERE (`employee` = @user_employee_id_new);
select @user_id = id from `user` WHERE (`employee` = @user_employee_id_old);
UPDATE `user` SET `employee` = @user_employee_id_new WHERE id = @user_id;
Appreciate it. Thanks!