[Turn] A simple Oracle applet that generates a random phone/phone number/Social Security Number/bank card number/address/email, etc.

Source: Internet
Author: User

In some scenarios we may need to generate some random data, such as generating phone numbers, e-mail addresses and other data in a test environment for functional testing. Or import the production data into the test environment for simple desensitization processing. This is what I developed on the basis of dbms_random to generate:

    • Mobile phone number
    • Phone number
    • Email
    • ID number
    • Bank card number
    • Address

An Oracle package, interested friends can download from here: Http://pan.baidu.com/s/1pJBkVyF
Of course limited to personal ability and other reasons, there are many shortcomings, please correct me.

Generate a random phone number:

Click ( here) to collapse or open

    1. BEGIN
    2. For F in 1..30
    3. LOOP
    4. Dbms_output. Put_Line (Uext_random.random_mobile);
    5. END LOOP;
    6. END;
    7. /



Generate Random phone numbers:

Click ( here) to collapse or open

    1. BEGIN
    2. For F in 1..30
    3. LOOP
    4. Dbms_output. Put_Line (Uext_random.random_phone);
    5. END LOOP;
    6. END;
    7. /



Generate Random e-mail:

Click ( here) to collapse or open

    1. BEGIN
    2. For F in 1..30
    3. LOOP
    4. Dbms_output. Put_Line (Uext_random.random_email (' @test. sinatay.com '));
    5. END LOOP;
    6. END;
    7. /



Generate a random ID number:

Click ( here) to collapse or open

    1. BEGIN
    2. For F in 1..30
    3. LOOP
    4. Dbms_output. Put_Line (Uext_random.random_idnum);
    5. END LOOP;
    6. END;
    7. /



Generate random bank card number:

Click ( here) to collapse or open

    1. BEGIN
    2. For F in 1..30
    3. LOOP
    4. Dbms_output. Put_Line (Uext_random.random_bankcard);
    5. END LOOP;
    6. END;
    7. /



Generate a random address:

Click ( here) to collapse or open

    1. BEGIN
    2. For F in 1..30
    3. LOOP
    4. Dbms_output. Put_Line (UEXT_RANDOM.RANDOM_ADDR);
    5. END LOOP;
    6. END;
    7. /



Generate random data as much as possible to conform to the true rules, such as randomly generated ID 610923197108235117, through the Baidu Application ID query tool, only the last error:


enjoy!

[Turn] A simple Oracle applet that generates a random phone/phone number/Social Security Number/bank card number/address/email, etc.

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.