Helpful Information
 
 
Category: Oracle Development
underscore search in oracle

I need to search the name that contains underscore.

The query I sent was

select name from table where name like '%N__% ;

and I get all the names that has single underscore too
My output was

N_1
N__1
N_1_2

whereas I should be getting only N__1

I understand that '_' is a special character like '%' in oracle.Difference being '_' is for single character match & '%' is for any number of characters match.

Any help how to modify my query to get the required name only ?

Thanks in advance.

Please try:

select name from table where name like '%N\_%' ESCAPE '\';

cheers,
Dan

Thanks. Already got it working.










privacy (GDPR)