我有一个 MySQL 函数。在这个函数内部,我想在它运行时打印变量的值。
DELIMITER $$
CREATE DEFINER=`root`@`localhost` FUNCTION
`updateCompanyName`(companyName varchar(200)) RETURNS varchar(200)
CHARSET latin1 BEGIN
declare modifiedCompanyName varchar(200);
DECLARE keywordToRemove varchar(200);
DECLARE cur1 CURSOR FOR SELECT name FROM company_remove_keywords;
select regex_replace('[^a-zA-Z 0-9]', "",companyName) into modifiedCompanyName;
OPEN cur1;
read_loop: LOOP
FETCH cur1 INTO keywordToRemove;
select keywordToRemove;
select replace_ci(modifiedCompanyName,
concat(" ",keywordToRemove," ")," ")
into modifiedCompanyName;
select replace_ci(modifiedCompanyName,
concat(" ",keywordToRemove),"")
into modifiedCompanyName;
END LOOP;
CLOSE cur1;
return modifiedCompanyName;
END
打印值的最佳方法是什么:keywordToRemove
和modifiedCompanyName
?