Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

BUG with ESCAPE CHARACTER in SQL QUERY ???

486717Jan 30 2006 — edited Jul 11 2006
Hi !
I'm trying to escape some special characters (%, ', _ ) with Oracle 9.2 . I read in oracle documentation and on forums how to make this. The way given is :

SELECT last_name
FROM employees
WHERE last_name LIKE ’%\%%\_%’ ESCAPE ’\’;

BUT this doesn't work for me:
"ORA-01425: Given escape character for LIKE is not a character string of length 1"

I try others ways :
- I changed the character '\' by '*' or '+', '!', ... and finally with 'a', 'c' but the result is the same.
- When i changed '\' by '\\' or 'N~', '\\\\' , ... the query is well-executed, but no row is found ,even if in my table there's employees with last_name 'aaa_zzz' .

If anybody can explained me why this? Or better if anybody knows how to solve this? Thanks a lot because i have no more ideas now ( is it an SQL bug, or a problem of configuration).
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 8 2006
Added on Jan 30 2006
12 comments
6,061 views