Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

select * from table_name where column like '&nbsp'

Tags:

sql

oracle

I need to find records containing html code such as '&nbsp' But when I try to run the select * from table_name where column like '&nbsp%' I got prompt asking for the value of nbsp. I guess the database thinks that nbsp is a parameter. I am wondering if the is an escape character so that I can tell the database that "&" is part of my query string. I tryed '\&nbsp' but didn't work.

My environment is Oracle 9i with sqlplus client.

Thanks.

like image 834
Wei Ma Avatar asked Dec 24 '09 08:12

Wei Ma


3 Answers

Have a look at this:

SQL Plus FAQ

e.g.

SET ESCAPE '\'
SELECT '\&abc' FROM dual;
like image 89
davek Avatar answered Oct 03 '22 04:10

davek


Easier way:

SET DEFINE OFF

See: SET DEFINE

like image 24
wadesworld Avatar answered Oct 03 '22 06:10

wadesworld


The backslash should work, but I think you need to start your query with

SET ESCAPE ON
like image 43
Paddyslacker Avatar answered Oct 03 '22 04:10

Paddyslacker