Welcome 微信登录

首页 / 数据库 / MySQL / 关于Oracle的where条件有特殊符号的处理

关于Oracle的where条件有特殊符号的处理有这样的一些数据:
 select "fie_a" as col from dual
 union all
 select "fie_b" as col from dual
 union all
 select "fi_a" as col from dual
 union all
 select "fi_b" as col from dual;
 
我需要从这些数据中查找fi_开头的数据,一般写法是:
 select *
 from (
     select "fie_a" as col from dual
     union all
     select "fie_b" as col from dual
     union all
     select "fi_a" as col from dual
     union all
     select "fi_b" as col from dual
 ) t
 where t.col like "fi_%";
 
但这样写并不能得到我们想要的结果,那么我们需要作如下处理:
 
select *
 from (
     select "fie_a" as col from dual
     union all
     select "fie_b" as col from dual
     union all
     select "fi_a" as col from dual
     union all
     select "fi_b" as col from dual
 ) t
 where t.col like "fi\_%" escape "";更多Oracle相关信息见Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12Oracle 性能相关常用脚本(SQL)ORA-08002: 序列 SEQ_WGB_TEST2.CURRVAL 尚未在此会话中定义相关资讯      Oracle where  Oracle符号 
  • Oracle中where子句和having子句中  (01/04/2013 12:30:49)
本文评论 查看全部评论 (0)
表情: 姓名: 字数