开发者

Oracle special characters

开发者 https://www.devze.com 2023-01-15 13:34 出处:网络
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 quer

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

精彩评论

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