Friday, March 9, 2012

Oracle query with &

I have a SQL task that I want to execute a query like:

SELECT firstField FROM schema.table WHERE fieldName = 'M&M'

The problem is when I put that in, it won't run.

For SQL*Plus I can stick SET DEFINE OFF before it and it work, not so in Integration Services.

The issue apparently is that &M is treated by Oracle as a variable of some sort.

Any help is appreciated.

Try using char(38) ... SELECT firstField FROM schema.table WHERE fieldName = 'M'||char(38)||'M'|||Thanks. That worked as does 'M' || '&' || 'M'. I'm glad I normally just work with SQL Server Smile|||

Larry Charlton wrote:

Thanks. That worked as does 'M' || '&' || 'M'. I'm glad I normally just work with SQL Server

Do you work at a chocolate manufacturer Larry Smile

http://www.m-ms.com/

-Jamie

No comments:

Post a Comment