h1

Extract and group SQL WHERE clauses

2008-07-23

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.

Advertisements

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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: