开发者

select * from table_name where column like '&nbsp'

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 Oracl开发者_JS百科e 9i with sqlplus client.

Thanks.


Have a look at this:

SQL Plus FAQ

e.g.

SET ESCAPE '\'
SELECT '\&abc' FROM dual;


Easier way:

SET DEFINE OFF

See: SET DEFINE


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

SET ESCAPE ON


In PL/SQL, you would use:

BEGIN select <Column> from <Table_name> into <Variable> where <Column> LIKE '\&nbsp\%' ESCAPE '\'; END /

Resources:

Wilcards in SQL on PSOUG.org

LIKE Condition in Oracle® Database SQL Language Reference 11g Release 2 (11.2)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜