Oracle obtains the desired data analysis from the string resource

Source: Internet
Author: User

[Oracle] Get the data analysis you want from a string resource
Requirements: Order analysis, according to the game, account level, game account occupation, district clothing, price range analysis of the transaction data movement


Target: Order Form
Processing analysis: The order can be read directly to the marked Games, district services, prices. And there are already relevant configurations that can be associated with this class

Information.
Problem Analysis 1: Account occupation, account level and other transaction information is not detailed in the order, can only be obtained through other information

Take.
Handling Ideas 1: Approximate analysis of occupation and account levels through the headings in the order.
The title format is as follows:

Process ideas: Extract the occupation and account level from the title.
Occupational:
Substr
(
O5.bizoffername,
InStr (O5.bizoffername, ' "', 1, 1) +1,
InStr (O5.bizoffername, ",")-(InStr (O5.bizoffername, ' "', 1, 1) +1)
)
Level:
Substr
(
O5.bizoffername,
InStr (O5.bizoffername, ", 1, 3) +1,
InStr (O5.bizoffername, ' class ', ")-(InStr (O5.bizoffername,", 1, 3) +1)
)
Processing results

Problem Analysis 2: Levels similar to ' 50 ' are extracted from the string as parameters and account level interval dimensions are compared

Invalid characters will occur.
Treatment Ideas 2: The decisive thought of converting characters into number,to_number.
Problem Analysis 3: Invalid characters are encountered after conversion to To_number.
Processing Ideas 3: There are other problems, so a custom function is_number is created.
CREATE OR REPLACE FUNCTION is_number (parameter VARCHAR2) RETURN number is
Val number;
BEGIN
Val: = To_number (NVL (parameter, ' a '));--Copy the character a if the parameter is null
RETURN 1;
exception--when encountering ' 40 ' such to_number conversion normal, when encountered ' 40 ' when the To_number abnormal return 0,
When OTHERS Then
RETURN 0;
END;
Then I looked at the basic data that was dealt with in thought 1, with where is_number (level) = 0, and found that there were really few

Dealing with an irregular ' Hello 20 ' similar level field and number interval judge the error when it comes to the root of the problem. So I had to drain it.

These dozens of irregular data. Finally get the business needs:

Oracle obtains the desired data analysis from the string resource

Related Article

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.