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
- BEGIN
- For F in 1..30
- LOOP
- Dbms_output. Put_Line (Uext_random.random_mobile);
- END LOOP;
- END;
- /
Generate Random phone numbers:
Click ( here) to collapse or open
- BEGIN
- For F in 1..30
- LOOP
- Dbms_output. Put_Line (Uext_random.random_phone);
- END LOOP;
- END;
- /
Generate Random e-mail:
Click ( here) to collapse or open
- BEGIN
- For F in 1..30
- LOOP
- Dbms_output. Put_Line (Uext_random.random_email (' @test. sinatay.com '));
- END LOOP;
- END;
- /
Generate a random ID number:
Click ( here) to collapse or open
- BEGIN
- For F in 1..30
- LOOP
- Dbms_output. Put_Line (Uext_random.random_idnum);
- END LOOP;
- END;
- /
Generate random bank card number:
Click ( here) to collapse or open
- BEGIN
- For F in 1..30
- LOOP
- Dbms_output. Put_Line (Uext_random.random_bankcard);
- END LOOP;
- END;
- /
Generate a random address:
Click ( here) to collapse or open
- BEGIN
- For F in 1..30
- LOOP
- Dbms_output. Put_Line (UEXT_RANDOM.RANDOM_ADDR);
- END LOOP;
- END;
- /
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.