سؤال

There's a database record that is incorrect. The name field displays like this in a browser ( this is incorrect ):

Thcˇodore

And when I look at the record via SQL results, I see:

Thc\xCB\x87odore

I'm trying to search for other records that might be affected, so I would like to query the name field for any value "LIKE" \xCB\x87

I've tried using HEXTORAW and many other combinations including:

REGEXP_LIKE(NAME, \'\xCC\x88\' )

REGEXP_LIKE(NAME, \'[\xCC\x88]\' )

NAME like '%' || HEXTORAW(\'CC88\') || '%'

NAME LIKE ‘%’ || X’CC’ || X’88’ ||’%’

NAME like \'%\' || \'\x88\' || \'%\'

Can't seem to get any of them to work, and I can't find any other examples or documentation online. Maybe I've been googling for the wrong things but this is what I've tried to google:

  1. oracle escape hexadecimal
  2. oracle hex to ascii
  3. oracle like hexadecimal query
  4. oracle pcre Hexadecimeal select
  5. oracle query binary character
  6. oracle REGEXP_LIKE hexadecimal
  7. oracle select \x0A
  8. oracle select escape character hex
  9. oracle select hex codes
  10. oracle select like \x0a
  11. oracle select REGEXP_LIKE \x0A
  12. oracle select X 0A

How can I search for \xCB\x87 with Oracle?

هل كانت مفيدة؟

المحلول

SQL> create table t1(c1 varchar2(20 char));

Table created.

SQL> insert into t1 values ('Thcˇodore');

1 row created.

SQL> commit;

Commit complete.

SQL> select * from t1;

C1
--------------------------------------------------------------------------------
Thcˇodore

SQL> select rawtohex(c1) from t1;

RAWTOHEX(C1)
--------------------------------------------------------------------------------
546863CB876F646F7265

SQL> select c1 from t1 where rawtohex(c1) like '%CB87%';

C1
--------------------------------------------------------------------------------
Thcˇodore

SQL>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى dba.stackexchange
scroll top