ITPub博客

首页 > Linux操作系统 > Linux操作系统 > union改写

union改写

原创 Linux操作系统 作者:yuxuan 时间:2008-05-29 15:16:15 0 删除 编辑

除了UNION,还有其它方法吗


SQL> desc oracle_collect_data
名称                                                                                                        是否为空? 类型
---------------------------------------------------------------------------------------------------
KEYWORDS                                                                                                    NOT NULL VARCHAR2(200)
TYPE                                                                                                                 VARCHAR2(100)
CONTENTS                                                                                                             CLOB
INPUT_DATE                                                                                                  NOT NULL DATE

select * from oracle_collect_data
where keywords like '%xxx%';
union
select * from oracle_collect_data
where keywords like '%yyy%';

有没有更佳方法

写错了, 应该如下:
SELECT *
FROM   ORACLE_COLLECT_DATE
WHERE  DECODE(SIGN(INSTR(KEYWORDS, 'xxx')), 1, 1,
              SIGN(INSTR(KEYWORDS, 'yyy'))) = 1;

SQL> select * from tmp;

       ITM LITM
---------- --------------------------------------------------
         1 xxx
         0 yyy

SQL>
SQL> Select * From tmp
  2  Where regexp_instr(litm,'x{3}|y{3}')>0
  3  ;

       ITM LITM
---------- --------------------------------------------------
         1 xxx
         0 yyy

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/1863/viewspace-324119/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 清空大日志方法
全部评论

注册时间:2008-01-02

  • 博文量
    14
  • 访问量
    103683