Oracle query performance testing, analyzing how adding an index impacts the execution plans or testing a ReSTful API pagination needs data. Having a quick way to generate tens and thousands of records is always helpful.
Recently had a similar need, start crafting a query to create
random and sparse data. Also required the data to look realistic
in date-of-birth, email, and ZIP fields. Below is a sample
script from that effort. Oracle’s DBMS_RANDOM
package is utilized
extensively.
Person table structure
PL/SQL block to generate rows
Below PL/SQL block is inserting one row at a time in the loop. There are other alternate ways as well.
Verify the result
Once the PL/SQL block completes, check the table contents.
Simple analysis of data
Below query will provide a very basic idea about how the data is spread.