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

Home -> Community -> Usenet -> c.d.o.server -> Re: Doing "DESC" in Pro*C

Re: Doing "DESC" in Pro*C

From: Stephane Faroult <sfaroult_at_oriolecorp.com>
Date: Sun, 11 Apr 1999 13:25:48 -0700
Message-ID: <3711054B.2215@oriolecorp.com>


Pauil Perkins wrote:  

> I've seen that you can do a DESCRIBE on a prepared DSQL statement, but this
> (I think) enumerates the types of the columns contained in the statement -
> i.e. requires prior knowledge of the table.

Paul,

 You're very close to it! The DESCRIBE is an excellent solution - you need no prior knowledge of the table if your statement is simply a 'SELECT * FROM <table_name>' - the 'select *' will be 'expended' by Oracle and you will get your list.
Another (and probably easier, if you are not too familiar with dynamic SQL) is to query the dictionary tables such as USER_TAB_COLUMNS or DBA_TAB_COLUMNS (never too sure about the name), or, if you feel more adventurous (and if your program is run by a DBA), a join on sys.user$, sys.obj$ and sys.col$. If you want to describe a huge number of tables, the easier way may also happen to be the best one, as the dynamic 'select *' means a new cursor and new parsing for each table, whereas in the second case you just have to bind the various ownername/tablenames to the same query.  

--
Regards,

  Stéphane Faroult
  Oriole Corporation



http://www.oriolecorp.com, designed by Oracle DBAs for Oracle DBAs
Received on Sun Apr 11 1999 - 15:25:48 CDT

Original text of this message

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