当前位置:Gxlcms > mysql > Oracle中的case语句

Oracle中的case语句

时间:2021-07-01 10:21:17 帮助过:24人阅读

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<201;

linux

人气教程排行