Re: How to suppress special characters in query

  • From: "Niall Litchfield" <niall.litchfield@xxxxxxxxx>
  • To: Harvinder.Singh@xxxxxxxxxxxxx
  • Date: Tue, 6 Feb 2007 21:09:47 +0000

On 2/5/07, Harvinder Singh <Harvinder.Singh@xxxxxxxxxxxxx> 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

Other related posts: