比较忽略字符串的SQL重音(ORACLE) [英] Compare Strings ignoring accents in SQL (ORACLE)
本文介绍了比较忽略字符串的SQL重音(ORACLE)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否存在一种简单的方法来比较两个文本值,而忽略重音和大写字母.我正在使用Oracle数据库. 我已经在寻找答案,但是老实说我不明白他们在这里提出的建议
I would like to know if there is an easy way to compare two text values ignoring the accents and upper case. Im working with an Oracle database. I already searched for an answer but honestly I don't understand what they proposed in here Accent and case insensitive collation in Oracle with LIKE. I tried that and it didn't work for me. Basically all I want to do is two compare to text values like 'pepé' and 'pepe' and obtain true as answer.
有没有LIKE指令就可以做到吗?
is it possible to do it without the LIKE instruction?
谢谢!
推荐答案
Oracle安装程序:
CREATE TABLE TABLE_NAME ( value ) AS
SELECT 'pepé' FROM DUAL;
-- Not necessary to create an index but it can speed things up.
CREATE INDEX value_without_accent_idx
ON TABLE_NAME ( CONVERT( value, 'US7ASCII' ) );
查询:
SELECT *
FROM table_name
WHERE CONVERT( value, 'US7ASCII' ) = 'pepe';
输出:
VALUE
-----
pepé
这篇关于比较忽略字符串的SQL重音(ORACLE)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文