Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: How to suppress special characters in query
On 2/5/07, Harvinder Singh <Harvinder.Singh_at_metratech.com> wrote:
>
> I tried the google and don't want to use the set option and the escape
> sequence specified in article is not working (I am not sure if it works for
> &). Following is the output from sqlplus:
>
>
>
> SQL> select * from tab1
>
> 2 where col1 like 'A \& b%' ESCAPE '\';
>
> Enter value for b:
>
>
>
> It works as an set option but not in the query and I was looking for
> something to work in the query without the set option:
>
> SQL> set ESCAPE '\'
>
> SQL> select * from t_account_mapper
>
> 2 where nm_login like 'A \& b%';
>
Why is it that you don't wish to use the sqlplus feature designed for this
purpose? This looks like a one-off sqlplus script, why not use sqlplus
commands in it? If you are using this sort of construct in a program of some
description I recommend using
select * from t_account_manager where nm_login like :1;
and build up the bind variable accordingly.
>
-- Niall Litchfield Oracle DBA http://www.orawin.info -- http://www.freelists.org/webpage/oracle-lReceived on Tue Feb 06 2007 - 15:09:47 CST
![]() |
![]() |