开发者

SQL LIKE query not working

I'm trying to run the following query against an Oracle DB, but the query is returning 0 records:

select * from TABLE 
where upper(FIELD) like '%SEE COMMENT%'

I know this field contains many records with 'See Comment" in it. For example, here is one of the records:

=if(and(Robust_Mean>=20,Robust_Mean<=70),.03*(Robust_Mean+29),
if(Robust_Mean>70,.083*(Robust_Mean^.9),"See Comment"))

I am guessing that the quotation marks in the field are mess开发者_开发百科ing the query up, but im not sure how to get around it. Any suggestions?


This works for me:

create table testLike (aCol varchar2(500) );

INSERT INTO TESTLIKE VALUES('abc');
insert into testLike values('=if(and(Robust_Mean>=20,Robust_Mean<=70),.03*(Robust_Mean+29),
if(Robust_Mean>70,.083*(Robust_Mean^.9),"See Comment"))');


SELECT * 
  FROM TESTLIKE TL 
 WHERE upper(tl.acol) like '%SEE COMMENT%';

can you recreate?

edit: in your query try this:

select * from TABLE 
WHERE UPPER(FIELD) = '=if(and(Robust_Mean>=20,Robust_Mean<=70),.03*(Robust_Mean+29),
if(Robust_Mean>70,.083*(Robust_Mean^.9),"See Comment"))';

see if that comes up with any results


Just realized there were two similarly named fields in this table, and I was choosing the wrong one.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜