开发者

Oracle special characters

I have a query

select * from table where name in ('52 T&M', '60 T&M');

The "&" is causing the query to expect a parameter. How do I qualify the开发者_JAVA百科 "&" in the query to sting so that the query can find string with the "&" character in them?


The ampersand ("&") is a character interpreted by SQLPlus as a variable placeholder. Use:

SET DEFINE OFF


I would normally use set define off as suggested by omg but it is also possible to do it like this:

select *
from table
where name in ('52 T'||Chr(38)||'M', '60 T'||Chr(38)||'M');


I assume you use sqlplus, so execute before

set scan off

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜