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
?