Oracle:在varchar字段中查找并替换html实体

时间:2011-12-09 16:06:09

标签: string oracle escaping html-entities

我正在尝试在varchar字段中找到html实体(例如ü):

set define off;
SELECT description FROM descriptions WHERE contains(description, 'ü') > 0;
SELECT description FROM descriptions WHERE contains(description, '&uuml') > 0;
SELECT description FROM descriptions WHERE contains(description, '%uuml%') > 0;

set define off;
set escape on;
SELECT description FROM descriptions WHERE contains(description, '\ü') > 0;
SELECT description FROM descriptions WHERE contains(description, '\&uuml') > 0;
SELECT description FROM descriptions WHERE contains(description, '\&uuml\;') > 0;

虽然有很多潜在的结果,但没有一个查询有效。 有任何想法吗? 非常感谢!

1 个答案:

答案 0 :(得分:1)

您是否在description上定义了Oracle Text索引?如果是这样,你是如何定义该指数的?加载数据后是否重新同步了索引?

如果您使用INSTR而不是CONTAINS,您会得到结果吗?

SELECT description 
  FROM descriptions 
 WHERE instr(description, 'ü') > 0;