Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: Is it a table or a view

Re: Is it a table or a view

From: Harald Maier <maierh_at_myself.com>
Date: Sat, 23 Aug 2003 14:07:56 +0200
Message-ID: <m3ekzcwp9f.fsf@ate.maierh>

"Fredrik Wahlgren" <fredrik.p.wahlgren_at_mailbox.swipnet.se> writes:

> In my client application, I want to delete a table that I have
> created. It's not a tempoary table but I use it as such. I have a
> method called drop table for this purpose. Before trying to drop the
> table, I check for existence by calling "SELECT COUNT(*) FROM
> user_tab_columns WHERE table_name = 'MyTempTable". I do this bcause
> I want to avoid errors.
>
> Now, I use this particular client to test various strategies to see
> what works best. I now think it would be worthwhile to let
> MyTempTable be a view instead of a table.
>
> I therefore need something likDropTableOrView, the idea beaing to
> use DROP VIEW if it's a view. How do I modify the first query so
> that it only finds a view with that name.

You might query the table user_objects:

,----
| SQL> select object_name, object_type from user_objects; `----

The attribute OBJECT_TYPE reports either VIEW or TABLE.

Harald

PS: IMO, the usage of a 'global temporary table' would be better. You should avoid ddl statements in client applications. Received on Sat Aug 23 2003 - 07:07:56 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US