Top 60 Oracle Blogs

Recent comments

Building Facebook or Germany ....

Whether it is for work, or we are just playing with a new idea back home, there comes a time when we need to create some test data for whatever it is we are testing. The biggest problem with creating test data, is creating some data, that actually looks like real data. Because we want "real" data, if we really want to test how our application works or performs. Things like index selectivity, histograms and much more inside oracle will all behave differently depending on what kind of data there are in your tables. So creating life like data, is important.

Luckily I have previously created a base library that generates random data within a lot of different data domains. The RANDOM_NINJA package can create all that data, but because of the required flexibility in that library, it might not be user friendly, if you just want to create some tables fast to test on. So I decided to create a library that is based on the random_ninja library but binds it together in a little more easy way to create data.

The library is based on generators. All generators are pipelined functions, making it easy to use in create table statements. All generators by default will return 10 rows, but that can be controlled by setting the testdata_ninja.g_default_generator_rows parameter.

In the future there will be more control options for the generators, apart from just the rowcount. The current available generators (and their fields) are:

  • people - Generate a table of people with basic information.
    • Country - Country of the person.
    • Identification - The ID number of the person. Will be a valid ID based on the Country.
    • First name - First name. Will be country and gender specific if data is available in random_ninja.
    • Middle name - Possible middle name. Will be country and gender specific if data is available in random_ninja.
    • Last name - Last name. Will be country and gender specific if data is available in random_ninja.
    • Birthdate - Birthdate of the person.
    • Gender
  • users - Generate a table of website users.
    • Username - Username of website user.
    • Email - User email address.
    • Address1 - First part of address. Always present.
    • Address2 - Second part of address. Randomly present.
    • Zipcode - Zipcode of the address.
    • State - State of the address.
    • Creditcard - Type of credit card.
    • Creditcard number - Creditcard number.
    • Creditcard expiry - Creditcard expiry.
    • Password - The hashed password.
  • cdr - Generate a table of cdr records.
    • Orig imsi - IMSI number of the originating caller phone.
    • Orig isdn - Phone number of originating caller.
    • Orig imei - IMEI of originating caller.
    • Call type - Call type.
    • Call type service - Call service type.
    • Call start latitude - Latitude of the originator at the start of the call.
    • Call start longtitude - Longtitude of the orginator at the start of the call.
    • Call date - Date of the call.
    • Call duration - Call length in seconds.
    • Dest imsi - IMSI number of the destination caller phone.
    • Dest isdn - Phone number of destination phone.
    • Dest imei - IMEI of destination.
    • Network operator - Network operator code.
  • articles - Create a table of articles.
    • Author - The author of the article.
    • Written - Date article is written.
    • Headline - Headline.
    • Lead paragraph - Leading paragraph.
    • Main article - The main part of the article.
    • End paragraph - Final articel paragrpah.