Connor and Chris will both be at AI World from October 12 to October 17 , the premier Oracle conference of 2025. If you're in Vegas, please come say Hi or pop into our sessions
Thanks for the question, Ken.
Asked: January 09, 2018 - 6:05 pm UTC
Last updated: January 10, 2018 - 4:47 am UTC
Version: Oracle Database 12c Standard Edition Release 12.1.0.2.0 - 64bit Production
Viewed 1000+ times
SQL> select banner from v$version where rownum = 1; BANNER ----------------------------------------------------------------------------- Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production 1 row selected. SQL> SQL> select x from 2 ( 3 select 'A_Babc' x from dual 4 union all 5 select 'A$Bxyz' x from dual 6 ) 7 where x like 'A~_B%' escape '~'; X ------ A_Babc 1 row selected. SQL> SQL> SQL> select x from 2 ( 3 select 'A_Babc' x from dual 4 union all 5 select 'A$Bxyz' x from dual 6 ) 7 where x like 'A\_B%' escape '\'; X ------ A_Babc 1 row selected. SQL> select banner from v$version where rownum = 1; BANNER ------------------------------------------------------------------------------ Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production SQL> SQL> select x from 2 ( 3 select 'A_Babc' x from dual 4 union all 5 select 'A$Bxyz' x from dual 6 ) 7 where x like 'A~_B%' escape '~'; X ------ A_Babc SQL> SQL> SQL> select x from 2 ( 3 select 'A_Babc' x from dual 4 union all 5 select 'A$Bxyz' x from dual 6 ) 7 where x like 'A\_B%' escape '\'; X ------ A_Babc SQL> select banner from v$version where rownum = 1; BANNER ----------------------------------------------------------------------------- Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production SQL> SQL> select x from 2 ( 3 select 'A_Babc' x from dual 4 union all 5 select 'A$Bxyz' x from dual 6 ) 7 where x like 'A~_B%' escape '~'; X ------ A_Babc SQL> SQL> SQL> select x from 2 ( 3 select 'A_Babc' x from dual 4 union all 5 select 'A$Bxyz' x from dual 6 ) 7 where x like 'A\_B%' escape '\'; X ------ A_Babc
SQL> select x from 2 ( 3 select 'A_Babc' x from dual 4 union all 5 select 'A$Bxyz' x from dual 6 ) 7 where x like 'A\_B%' escape '\ '; -- trailing space where x like 'A\_B%' escape '\ ' * ERROR at line 7: ORA-01425: escape character must be character string of length 1
The Oracle documentation contains a complete SQL reference.