I need to create a procedure that:
1) selects some text from a field in a table and stores it in a variable
2) updates the same record field only adding the date in yyyymmdd format plus additional text input into the procedure
…something like this…
delimiter //
create procedure table1.sp_updateComment (IN inputIP varchar(15), IN inputAccount varchar(10))
begin
start transaction;
select comment from table1 where ip = inputIP;
update table1 set comment = '<comment from above> + yyyymmdd + inputAccount', status = 'u' where ip = inputIP;
commit;
end;
//
delimiter ;
;
thanks in advance 🙂
Use SELECT…INTO to select some value and store it in a variable:
However, it doesn’t seem necessary in your case. Try using CONCAT: