Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: finding column names
In article <34350938.2E227786_at_gis.shl.com>, karsten
<karsten_at_gis.shl.com> writes
>Hi,
>
> I am looking for an efficient way to find out whether a table
> has a certain column (or a set of columns) or not.
>
> As far as I can see, there are two options:
>
> 1) try to select these columns, and catch the exception "invalid column
> name"
>
> 2) query the data dictionary (all_tables / all_tab_columns)
>
> which way is to prefer ? (considering sga, reparsing, caching ....)
>
>Thanks
>Karsten
Personally, I'll go for the second method. To use the first method you'll have to rely on knowing some particular ORA- error number or worse the error text. As we all know, these numbers can't really be relied on not to change in further releases of Oracle.
-- Bola OgunlanaReceived on Sat Oct 04 1997 - 00:00:00 CDT