Extract and group SQL WHERE clauses


I’m just going through an exercise at the moment to check that an Oracle DB is properly indexed, and since all the queries are done from stored procedures, with 100,000+ lines of source sprinkled over hundreds of files, I wanted something to quickly snarf all the WHERE clauses out, rather than go looking for them by eye.

So I just scribbled down a silly perl script, catted all the PL/SQL source through it, and got a plausible-looking list of WHERE clauses, ordered by decreasing frequency of occurrence in the code.

Hooray! Time for a beer.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: