HTML 제거
SET GLOBAL log_bin_trust_function_creators=1; DROP FUNCTION IF EXISTS fnStripTags; DELIMITER | CREATE FUNCTION fnStripTags( Dirty VARCHAR(4000) ) RETURNS VARCHAR(4000) DETERMINISTIC BEGIN DECLARE iStart, iEnd, iLength INT; WHILE Locate( '<', Dirty ) > 0 AND Locate( '>', Dirty, Locate( '<', Dirty )) > 0 DO BEGIN SET iStart = Locate( '<', Dirty ), iEnd = Locate( '>', Dirty, Locate('<', Dirty )); SET iLength = ( iEnd - iStart) + 1; IF iLength > 0 THEN BEGIN SET Dirty = INSERT( Dirty, iStart, iLength, ''); END; END IF; END; END WHILE; RETURN Dirty; END; | DELIMITER ; SELECT fnStripTags('this <html>is <b>a test</b>, nothing more</html>');