Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: So basic - how do I get column names?
Thanks all for your help.
Of course I started out with "desc mytable" but from perl DBD::Oracle it
didn't work correctly.
"select * from mytable where 1=2" seems favourite (on the min number of
letters to type basis ;-)
Lee
"Adrian Carlson-Hedges" <adrian.ch_at_btinternet.com> wrote in message
news:9tgpq2$758$1_at_plutonium.btinternet.com...
> SELECT column_name
> FROM all_tab_columns
> WHERE table_name = 'MYTAB';
>
> Or if you wanted it in a long line, you could use the above as a cursor in
a
> procedure, then use dbms_output.put() to append each column name to the
> buffer, then print them at the end of the procedure.
>
> Or the methods Jane suggested earlier will of course also work.
>
> Adrian
>
> "Lee Crampton" <lee_at_avbrief.com> wrote in message
> news:lYgK7.12484$tm3.1786101_at_news11-gui.server.ntli.net...
> > Hi all
> >
> > Ordinarily something like "select * from mytable where false;" would
> return
> > column headings (no rows).
> > This doesn't work in Oracle8i and I cannot for the life of me find
either:
> > a) the way to return just headings (tried column heading on, col * on
etc)
> > b) an alternative way to retrieve column names
> > Any help gratefully received
> > Lee
> >
> >
>
>
Received on Thu Nov 22 2001 - 05:13:36 CST
![]() |
![]() |