codemonth.dk

One project every month - making stuff better ...

Random null value in plsql generated data

I have added another small feature to the testdata library. The ability to create random data is good, but sometimes you also need to have "gaps" in that data. So I made it possible to randomly create null instead of a value for any generated field. Simply surround the generator function in parentheses and add how big a percentage the chance are of a null value after the parentheses.

Topological sorting in PLSQL

For my testdata_ninja library, I recently created the field auto reference feature, where a value from one field can be used as an input to a generator for another field. Part of this feature involves parsing all columns and building a dependency list (Directed Acyclic Graph) sorting all columns correctly. Since everything in the library is build purely in plsql, I don't store anything in tables. So if my data is not in a table, I cannot use sql as one would normally do it. I couldn't find any code out there that did what I wanted, so like much of the other stuff I do, I had to build it myself.

Chinese support added to parts of the plsql random data generator

For quite a while I have been wanting to add Chinese support to some of the dbms_random functions, and this last weekend I finally got some time to work a little bit on it. So now the library support Chinese output in functions in the core_random package, text_random package and location_random package.

Recursive test data using plsql and the testdata_ninja package

Just the other day I was running a test of a system at work. I have already run several tests against this system, so I already have a test data generator to generate clients in the system. This time though I had to generate some orders within the system. So a really quick way to do that is to reuse the existing generator for the client id reference (a foreign key in the real system) from the orders data rows. This way I don't have to create an actual client table. I can just reference the plsql test data generator directly in my definition of my order generator.