ORACLENERD twitter/oraclenerd view chet justice's profile on LinkedIn feed oraclenerd t-shirts Unemployment Clock:

  Exception Handling WTF
In homage to Oracle WTF.

Trying to remove references for a table that no longer exists (a view was created in it's place), I found this little gem:
OPEN c FOR
SELECT 'INVALID USER'
FROM dual;

RETURN c;

It was nested in an IF-END IF block.

Instead of just throwing the exception or return 0 (zero) rows, this was the preferred method.

Awesome!

Labels: ,

 
Comments:
When you say you're trying to remove references to a table that no longer exists, and that a view had been created in its place: '':-\ (my favorite emoticon of late - me scratching my head...I find I can use that one ALOT)...um, what do you mean?

Do you mean that a view was created that referenced the table, and then the table was dropped, rendering the view invalid?

First.

Then second, "removing references to the table"...'':-\...do you mean that you want to find objects in the db that reference the non-existent table so you can modify/drop those as well?

If so, how does this cursor help you do that? Seems to me that "SELECT 'INVALID USER' FROM DUAL" would always return a row and would therefore not be a reliable indicator.

'':-\.

Thanks for your help.

'':-\
 
The problems were mutually exclusive, I obviously didn't articulate that very well.

A table was deprecated, but a view was used to replace it so not to break everything...when I say everything, I mean there were over 700 references to this table.

The view replicated the functionality of the table mostly for JOIN purposes. Since it's a view the columns are un-indexed thus causing performance degredation.

As I was pouring through thousands of lines of code, I ran across the SELECT 'INVALID USER' FROM dual gem.
 
Post a Comment



Links to this post:

Create a Link



<<Home


Guest Authors

How To

Popular

Previous Posts

Code Projects

Archives
August 2007 / September 2007 / October 2007 / November 2007 / December 2007 / January 2008 / February 2008 / March 2008 / April 2008 / May 2008 / June 2008 / July 2008 / August 2008 / September 2008 / October 2008 / November 2008 / December 2008 / January 2009 / February 2009 / March 2009 / April 2009 / May 2009 / June 2009 / July 2009 / August 2009 / September 2009 / October 2009 / November 2009 / December 2009 / January 2010 / February 2010 / March 2010 /


Aggregated by OraNA