Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: How to suppress special characters in query

Re: How to suppress special characters in query

From: Niall Litchfield <niall.litchfield_at_gmail.com>
Date: Tue, 6 Feb 2007 21:09:47 +0000
Message-ID: <7765c8970702061309l35d8d54ei825b4a3ca3e085c@mail.gmail.com>


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-l
Received on Tue Feb 06 2007 - 15:09:47 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US