Re: Is this the sanctioned way to ascertain a table's existence?

From: Noons <>
Date: Tue, 20 Oct 2009 21:17:12 +1000
Message-ID: <hbk2ma$496$>

Palooka wrote,on my timestamp of 19/10/2009 10:58 AM:

> Assuming that your PL/SQL has half decent error handling, Serge's way is
> much better IMHO. Anyway, as he he says, if the table does not exist/is
> not visible, the block will not compile.

And the "is not visible" bit is the important point there, IMHO. Using the view USER_TABLES presumes the table(s) to be checked are created by the user firing off the SQL. In this day and age of dbs with multiple schemas and cross-schema access (consolidation et all) it's much better to check on visibility: the table might be there and accessible, just not owned by the schema of the same name as the user. That means using ALL_TABLES, not USER_TABLES, at the very least. And what happens then if it is a view, not a table? I still think Serge's (and Maxim's) approach of checking via parsing is the correct one: it covers everything. Either the object (be it table or view) is accessible or not, doesn't matter from where and in what conditions. Received on Tue Oct 20 2009 - 06:17:12 CDT

Original text of this message