如何在Oracle中的查询结果中显示字段的隐藏字符?

Chr*_*ams 2 oracle plsql

我有两行,根据Java,varchar列是不同的.equals().我无法轻松更改或调试针对此特定数据库运行的Java代码,但我有权使用SQLDeveloper直接对数据库执行查询.这些字段对我来说看起来是一样的(它们是街道地址,其中两行由一些新行或托架提要/新行组合分隔).

有没有办法看到所有隐藏的字符作为查询的结果?我想避免必须在每一行上使用ascii()函数substr()来找出哪个隐藏字符是不同的.

我也接受一些查询,告诉我哪个字符是两个字段之间的第一个区别.

Ren*_*ger 5

尝试

select dump(column_name) from table
Run Code Online (Sandbox Code Playgroud)

更多信息在文档中.

至于找到角色不同的位置,这可能会给你一个想法:

create table tq84_compare (
  id  number,
  col varchar2(20)
);

insert into tq84_compare values (1, 'hello world');
insert into tq84_compare values (2, 'hello' || chr(9) || 'world');

with c as (
 select
  (select col from tq84_compare where id = 1) col1,
  (select col from tq84_compare where id = 2) col2
 from
  dual
),
l as (
  select
  level l from dual
  start with 1=1
  connect by level < (select length(c.col1) from c)
)
select 
  max(l.l) + 1position
from c,l
  where substr(c.col1,1,l.l) = substr(c.col2,1,l.l);
Run Code Online (Sandbox Code Playgroud)