1

我有一个字符串,它排列成一个没有空格和一些字符且没有标点符号的字符串。最后的字符串是 6 个字符“ABCDEF”,但长度是 7。为什么?它在甲骨文中。

select 
 regexp_replace((upper(utl_raw.cast_to_varchar2((nlssort(trim('a.Bc d-E/f'), 'nls_sort=binary_ai'))))), '[/:.,- ]|\d', '') as column_1
,length(regexp_replace((upper(utl_raw.cast_to_varchar2((nlssort(trim('a.Bc d-E/f'), 'nls_sort=binary_ai'))))), '[/:.,- ]|\d', '')) as length_1
from dual

谢谢

4

1 回答 1

1

看起来 utl_raw.cast_to_varchar2() 将空终止符添加到 LENGTH() 计数的字符串中:

SQL> select
    dump(utl_raw.cast_to_varchar2(nlssort('a.Bc d-E/f', 'nls_sort=binary_ai')
) as column_1
   from dual;

COLUMN_1
-------------------------------------------------------------------------------

Typ=1 Len=11: 97,46,98,99,32,100,45,101,47,102,0

SQL>
于 2017-05-10T13:50:24.380 回答