Databases
cancel
Showing results for 
Search instead for 
Did you mean: 

Escapw characters within Sql plus

SOLVED
Go to solution
Dave Walley
Frequent Advisor

Escapw characters within Sql plus

Good morning.

I am trying to retrieve all objects with an underscore in the name, as an underscore means any single character I cant use that, how can I escape the _ so that it is not interpreted?.

E.g.
select tablespace_name from dba_tablespaces where tablespace_name like 'HELPME_D%';

This query will not return the correct answer.

I look forward to your replies.

Thanks

Dave
why do i do this to myself
2 REPLIES
Ian Lochray
Respected Contributor
Solution

Re: Escapw characters within Sql plus

Precede the underscore (_) character with an escape character and identify the escape character with the ESCAPE clause i.e
select tablespace_name from dba_tablespaces where tablespace_name like 'HELPME\_D%' ESCAPE '\';
Christian Gebhardt
Honored Contributor

Re: Escapw characters within Sql plus

Hi

You have to use escape-Sequence from select-Statement

select tablespace_name from dba_tablespaces where tablespace_name like 'HELPME\_D%' escape '\';

Chris