CREATE OR REPLACE FUNCTION FilterStr
(strVal VARCHAR2)
RETURN VARCHAR2
IS
strTmp VARCHAR2(2048) := strVal;
BEGIN
strTmp := replace(strTmp,chr(38),chr(38)||'amp;'); --chr(38) '&'
strTmp := replace(strTmp,'<',chr(38)||'lt;');
strTmp := replace(strTmp,'>',chr(38)||'gt;');
strTmp := replace(strTmp,'''',chr(38)||'apos;');
strTmp := replace(strTmp,'"',chr(38)||'quot;');
return strTmp;
END;
(strVal VARCHAR2)
RETURN VARCHAR2
IS
strTmp VARCHAR2(2048) := strVal;
BEGIN
strTmp := replace(strTmp,chr(38),chr(38)||'amp;'); --chr(38) '&'
strTmp := replace(strTmp,'<',chr(38)||'lt;');
strTmp := replace(strTmp,'>',chr(38)||'gt;');
strTmp := replace(strTmp,'''',chr(38)||'apos;');
strTmp := replace(strTmp,'"',chr(38)||'quot;');
return strTmp;
END;
PL/SQL字符串过滤函数
本文介绍了一个PL/SQL函数FilterStr,该函数用于将特定的字符或字符序列转换为对应的HTML实体,以提高网页显示的安全性和兼容性。具体操作包括将'&'转换为'&'、'<'转换为'<'、'>'转换为'>'、单引号转换为'''以及双引号转换为'"'。
1088

被折叠的 条评论
为什么被折叠?



