选择外语并排除阿拉伯语的查询

时间:2014-10-01 12:00:35

标签: oracle

我的列 COL1 包含不同的语言english,arabic

  col  col1
  __  __
  1  information
  2  معلومات

我正在搜索一个查询,只让我获得阿拉伯语字符

 col  col1
  __  __
  2  معلومات

我发现link使用的函数REGEXP_LIKE只能获得数字,有没有办法可以获得阿拉伯语?

修改

I did this 
   and o.col1 not like ('%A%')
   and o.col1 not like ('%B%')
   and o.col1 not like ('%C%')
   and o.col1 not like ('%D%')
   and o.col1 not like ('%E%')
   and o.col1 not like ('%F%')
   and o.col1 not like ('%G%')
   and o.col1 not like ('%H%')
   and o.col1 not like ('%I%')
   and o.col1 not like ('%J%')
   and o.col1 not like ('%K%')
   and o.col1 not like ('%L%')
   and o.col1 not like ('%M%')
   and o.col1 not like ('%N%')
   and o.col1 not like ('%O%')
   and o.col1 not like ('%P%')
   and o.col1 not like ('%Q%')
   and o.col1 not like ('%R%')
   and o.col1 not like ('%S%')
   and o.col1 not like ('%T%')
   and o.col1 not like ('%U%')
   and o.col1 not like ('%V%')
   and o.col1 not like ('%W%')
   and o.col1 not like ('%X%')
   and o.col1 not like ('%Y%')
   and o.col1 not like ('%Z%')

1 个答案:

答案 0 :(得分:1)

REGEXP_LIKE语法允许搜索[A-Z]范围内的字符。受@mounaim评论中给出的链接的启发,可以让REGEXP_LIKE使用此REGEXP_LIKE语法搜索Unicode范围0600-06FF:

select *
  from tab
 where regexp_like(col1, UNISTR('[\0600-\06FF]'))

如果您需要搜索超过基本阿拉伯语Unicode范围(http://en.wikipedia.org/wiki/Arabic_alphabet#Unicode),可以将其扩展为:

select *
  from tab
 where regexp_like(col1, UNISTR('[\0600-\06FF]|[\0750-\077F]|[\08A0-\08FF]|[\FB50-\FDFF]|[\FE70-\FEFF]'))

|这里是REGEXP OR 运算符,因此将搜索第一个范围中的字符 OR 第二个范围 OR 等......

5位十六进制Unicode范围我不知道如何搜索,但我猜测它们很少使用; - )