Usually we use like , we use % to give parts of string as query criteria. But what if % itself is part of the string, and we want search strings where % exists as part of the string.

Towards this end we can use escape, as we see in the example below. The same is the case when we use ‘_’  with LIKE.

 

SQL> create table test(x varchar2(20));

Table created.

SQL> insert into test values('clar%ke');

1 row created.

 

SQL> commit;

Commit complete.

 

SQL> select x

  2  from test

  3  where x  like '%\%%' escape '\'

 

 

Hosted by www.Geocities.ws

1