views:

63

answers:

2

See example:

http://stackoverflow.com/questions/189557/ora-00942-table-or-view-does-not-exist-how-do-i-find-which-table-or-view-it-is

Basically in a case like this Oracle responds with something like: SQL Error: ORA-00942: table or view does not exist

Obscure error messages from Oracle when using an ORM lib like Hibernate aren't exactly a once in a lifetime experience. Why doesn't Oracle simply mention the NAME of the table or view which doesn't exist? Why all the auditing and other complex "solutions" posted in the example question?

In short: Is there some rational, technical explanation for Oracle's seemingly piss poor error feedback, or is this more likely the result of a lack of motivation (on Oracle's part) to improve due to their almost 'monopolistic' popularity status? (Or other? Lack of coordination with ORM devs and DB vendors?)

Actually, this also begs the question of whether other competing (particularly OSS) DBs provide any better feedback, which I have no idea of really, so this may apply to more than just Oracle.

+3  A: 

This lack of table name is probably to help prevent code knowledge leaks. Typical example - if a webapp was badly coded, and an error like this propagated to the top-level & was displayed to the user, then an Evil Person could use that to SQL inject the site or do other bad stuff.

thecoop
Thanks, I think I can accept that (in this case at least). It'd be nice to have a 'debug mode' or something for devs though!
Crusader
A: 

"In short: Is there some rational, technical explanation for Oracle's seemingly piss poor error feedback, or is this more likely the result of a lack of motivation (on Oracle's part) to improve due to their almost 'monopolistic' popularity status? "

Bear in mind that Oracle is a venerable technology, stretching back thirty years. There is a huge extant code base. So changing fundamental behaviours could have widespread ramifications.

Whether you regard that as a "rational" or "technical" explanation is a matter of taste.

Most of us who use Oracle databases have learned to live with its quirks. for instance, it is a simple matter to reveal the table responsible for an ORA-00942 error:

prompt Dropping non_existent_table

drop table non_existent_table
/

It's not elegant but then not knowing the condition of our target schema is far from elegant. In fact, blindly issuing DROP TABLE statements is the blunderbuss approach to schema management.

"this also begs the question of whether other competing (particularly OSS) DBs provide any better feedback"

Certainly the equivalent MySQL error, MySQL Error: 1146, names the table. Of course, Oracle now owns MySQL, so its status as a competing DBMS is debatable :)

APC
Not schema management--initial schema generation for the Java dev who has better things to do with their time than hand-code sql scripts that could be generated instead. That said, product age and the difficulty maintaining a large code base makes sense as an explanation.
Crusader
Have you consider iterating over the tables in the data dictionary, dropping them, instead of hand-maintaining a script?
Adam Musch