Case statements in Oracle

Source: Internet
Author: User
1. The final_url after END is an alias 2. UTL_URL.unescape (final_url,

1. The final_url after END is an alias 2. UTL_URL.unescape (final_url,

1. final_url after END is an alias

2. UTL_URL.unescape (final_url, 'utf-8') is the decoded url.

3. At the beginning of Oracle10g, the database has built-in regular expressions that comply with the ieee posix (Portable Operating System for Unix) standard. The version below 10G does not support regular expressions except for like, so? \ & Use two 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 ('2017 00:00:00 ', 'yyyymmdhh24: mi: ss') and to_date ('2017 23:59:59', 'yyyymmdd hh24: mi: ss ') and list_channel_constant = 'channelke'

) Group by final_url order by total_pv desc

) Where rownum: <201;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.