Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Is it a table or a view
"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