我有一个字符串,它以字符串排列,没有空格和一些字符,没有标点符号。最后一个字符串是6个字符" ABCDEF"但长度是7.为什么? 它在ORACLE。
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
由于
答案 0 :(得分: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>