Oracle中ascii函数的逆向

Reverse of ascii function in Oracle

当我进行以下查询时

select asciistr(first_name) from person where id = 1

结果包含'0D'.

那么将 '0D' 转换为字符的反向函数是什么,这样我就可以找到具有该特定字符的所有名称。

你想要 UNISTR(并且,也许 CAST 它变成 VARCHAR2)。如果你有 table:

CREATE TABLE person ( first_name, id ) AS
SELECT 'A', 1 FROM DUAL UNION ALL
SELECT CAST( UNISTR( '0D' ) AS VARCHAR2(20) ), 1 FROM DUAL;

那么您的查询输出:

select first_name,
       asciistr(first_name)
from   person
where  id = 1

是:

FIRST_NAME | ASCIISTR(FIRST_NAME)
:--------- | :-------------------
A          | A                   
?          | 0D               

db<>fiddle here

0DU+200D ZERO WIDTH JOINER

如果您想查找带有此(不可打印)字符的姓名,请尝试

SELECT *
FROM person
WHERE first_name LIKE '%'||UNISTR('0D')||'%'

WHERE asciistr(first_name) LIKE '%0D%'