欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Oracle中的case语句

程序员文章站 2024-02-02 18:09:34
...

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

Oracle中的case语句