请教一个查询语句的写法 select * from a where fa like '%DL%'; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 晕!要查fa='DL'的干嘛要'DL8'来判断???直接用select * from a where fa='DL';不就行了?!是不是楼主没描述清楚? 在查询之前并不知道条件中是包含'DL'的,所以不能直接用fa='DL' select * from a where fa=substr('DL8',1,2); 假设你的变量名为v_strv_str中可能包含'DL8'也可能不包含,如果包含的话就查出fa='DL'的数据来,对不?select * from a where fa='DL' and exists(select 1 from dual where instr(v_str,'DL8')>0); heyixiang(子豚の愛人) 的方法是可以,实际上我想表达的是fa字段的值是条件中的子字符串,所以substr('DL8',1,2)只是一个特例,并不能涵盖所有的情况 不好意思,搞大了,只需:select * from a where fa='DL' and instr(v_str,'DL8')>0; select * from a where instr('dl8',fa)>0; 感谢njhart2003() ,这样写就可以了select * from a where instr('DL1',fa)>0; 友情提示:如果fa上建索引的话select * from a where instr('DL1',fa)>0;性能不如:select * from a where fa='DL' and instr(v_str,'DL8')>0;...... 10g怎么导出公共同义词 在线急求:无比郁闷 各位大侠帮小弟看看这个触发器怎么写? 发个垃圾帖,CSDN中如何添加引用别人的回复?答案正确即结帖 用SQL语句怎样实现这种效果? ADOX的问题! 关于数据库创建? 新建/删除用户和表的问题 求一个查询的写法,帮顶有份! CSDN 广告无所不在? 在OCCI中,如何在Insert一行数据的同时得到该行的ROWID? 我这个触发器为什么在在执行delete操作时不管用?
要查fa='DL'的干嘛要'DL8'来判断???
直接用select * from a where fa='DL';不就行了?!是不是楼主没描述清楚?
v_str中可能包含'DL8'也可能不包含,
如果包含的话就查出fa='DL'的数据来,对不?select * from a where fa='DL' and
exists(select 1 from dual where instr(v_str,'DL8')>0);
如果fa上建索引的话
select * from a where instr('DL1',fa)>0;
性能不如:
select * from a where fa='DL' and instr(v_str,'DL8')>0;......