Use the Oracle regular expression to select the region number from data entries

Source: Internet
Author: User

Use the Oracle regular expression to select the sequence number in data entries. Abstract: Use the Oracle regular expression to select the sequence number in data entries for the latest project. In the seven-digit string, select the sequence number according to the following rules: 1. the sequence number cannot contain numbers 4, 2, and 7 from the right to the left. At least three identical numbers must appear, and the same number can only be one of 6, 8, or 9, such as 1235666. 3. Seven digits can show all the same numbers, such as 1111111, 2222222, 3333333, 5555555, 6666666, and 7777777. in Oracle 10 Gb, we can easily implement the above requirements, you can use one SQL statement as follows:

SELECT * FROM a WHERE REGEXP_LIKE (id, '[^ 4] {4} [6] {3, 6} $') OR REGEXP_LIKE (id, '[^ 4] {4} [8] {3, 6} $') OR REGEXP_LIKE (id, '[^ 4] {4} [9] {3, 6} $ ') OR REGEXP_LIKE (id, '^ ([0-35-9]) \ 1 {6} $ ');

 

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.