Oracle SQL查找数据中的字符 [英] Oracle SQL find character ¡ in data

查看:137
本文介绍了Oracle SQL查找数据中的字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在数据库记录中找到这个下划线的字符吗?如果我喜欢这样

Is it possible to find this underscore i ¡ character in database records? If I do like this

select * from mytable where cell like '%¡%';

它找到行,在哪里?是存在的,而不是。但是这个 ?在这些字中是错误的字符,所以也许有编码问题。我认为编码是WIN1257

it founds rows, where ? is present, not ¡. But this ? is wrong character in those words so maybe there are encoding problems. I think encoding is WIN1257

推荐答案

尝试这样:

select * from mytable where instr(cell, UNISTR(<UNICODE code of your character>))>0;

示例:

create table mytable(
  cell varchar2(100)
);

insert into mytable values('normal string');
insert into mytable values('fünny string');
commit;

select * from mytable where instr(cell, UNISTR('\00fc'))>0;

输出:

CELL
-----------------------------------------------------------------------------------------------
fünny string

1 row selected.

编辑:像@Wernfried Domscheit推荐我改变了CHR - > UNISTR,使用任何字符集

Edited: like @Wernfried Domscheit recommended i've changed CHR --> UNISTR, - indeed this should work with any character set

这篇关于Oracle SQL查找数据中的字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆