Home > Database > Mysql Tutorial > Oracle中的case语句

Oracle中的case语句

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 17:02:15
Original
860 people have browsed it

1.END后面的 final_url是别名2.UTL_URL.unescape(final_url,

1.END后面的 final_url是别名

2.UTL_URL.unescape(final_url,'UTF-8') 是解码url

3.Oracle10g开始数据库内建了符合IEEE POSIX (Portable Operating System for Unix)标准的正则表达式,10g一下的版本除了like不支持正则,,所以?\&要用两个when

select   *   from (

    select UTL_URL.unescape(final_url,'UTF-8') as url,sum(list_pv_count) as total_pv from (

          select

            CASE

              WHEN INSTR(list_url,'?',28)>0 THEN   SUBSTR( list_url,0,(INSTR(list_url,'?',28)-1))

              WHEN INSTR(list_url,'&',28)>0 THEN   SUBSTR( list_url,0,(INSTR(list_url,'&',28)-1))

            ELSE list_url

            END final_url,

                      list_url,list_pv_count  from T_LOG_CHANNEL_TOP_LIST

          where list_date between to_date('20110629 00:00:00', 'yyyymmdd hh24:mi:ss') and to_date('20110629 23:59:59', 'yyyymmdd hh24:mi:ss') and list_channel_constant='BAIKE'

      )group by final_url order by total_pv desc  

 ) where rownum

linux

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template