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: NetComrade <andreyNSPAM_at_bookexchange.net>
Date: Mon, 05 Apr 2004 20:26:35 GMT
Message-ID: <4071c0c6.1481172774@localhost>


Thanks,

I was kind of aware of this feature, but didn't want to use PL/SQL.

I'll compare it to Connor's suggestion though.

On Sat, 03 Apr 2004 01:17:44 GMT, "VC" <boston103_at_hotmail.com> wrote:

>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
>
>

.......
We use Oracle 8.1.7.4 on Solaris 2.7 boxes remove NSPAM to email Received on Mon Apr 05 2004 - 15:26:35 CDT

Original text of this message

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