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: less expensive way to fetch column names?

Re: less expensive way to fetch column names?

From: VC <boston103_at_hotmail.com>
Date: Sat, 03 Apr 2004 01:17:44 GMT
Message-ID: <Ygobc.163501$_w.1789134@attbi_s53>


Hello,

"NetComrade" <andreyNSPAM_at_bookexchange.net> wrote in message news:406de334.1231442431_at_localhost...
> is there are a less expensive way to get column names from a table
> then doing
> SELECT LOWER(column_name)
> FROM user_tab_columns
> WHERE table_name ='my_table'
> ORDER BY column_id
> .......
> We use Oracle 8.1.7.4 on Solaris 2.7 boxes
> remove NSPAM to email

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production With the Partitioning, OLAP and Oracle Data Mining options JServer Release 9.2.0.4.0 - Production

SQL> set serverout on
SQL> declare

  2    l_cur   int default dbms_sql.open_cursor;
  3    l_desc  dbms_sql.desc_tab;
  4    l_ncols int;

  5 begin
  6 dbms_sql.parse(l_cur, 'select * from user_objects', dbms_sql.native);
  7 dbms_sql.describe_columns(l_cur, l_ncols, l_desc);   8 dbms_sql.close_cursor(l_cur);
  9 for i in 1..l_ncols loop
 10 dbms_output.put_line(l_desc(i).col_name);  11 end loop;
 12 end;
 13 /
OBJECT_NAME
SUBOBJECT_NAME
OBJECT_ID
DATA_OBJECT_ID
OBJECT_TYPE
CREATED
LAST_DDL_TIME
TIMESTAMP
STATUS
TEMPORARY
GENERATED
SECONDARY PL/SQL procedure successfully completed.

SQL> VC Received on Fri Apr 02 2004 - 19:17:44 CST

Original text of this message

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