dbTalk Databases Forums  

Select statement that returns field size?

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss Select statement that returns field size? in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rich
 
Posts: n/a

Default Select statement that returns field size? - 05-05-2010 , 01:05 PM






I am using 10g.

I want to do a select statement that will give me the name of the
fields in a table. And I also want to know the field type and field
size.

Can this be done?

Regards

Reply With Quote
  #2  
Old   
Maxim Demenko
 
Posts: n/a

Default Re: Select statement that returns field size? - 05-05-2010 , 01:08 PM






On 05.05.2010 20:05, Rich wrote:
Quote:
I am using 10g.

I want to do a select statement that will give me the name of the
fields in a table. And I also want to know the field type and field
size.

Can this be done?

Regards
Look up in the docs dba/all/user_tab_columns data dictionary view

Best regards

Maxim

Reply With Quote
  #3  
Old   
Mark D Powell
 
Posts: n/a

Default Re: Select statement that returns field size? - 05-06-2010 , 08:08 AM



On May 5, 2:08*pm, Maxim Demenko <mdeme... (AT) gmail (DOT) com> wrote:
Quote:
On 05.05.2010 20:05, Rich wrote:



I am using 10g.

I want to do a select statement that will give me the name of the
fields in a table. And I also want to know the field type and field
size.

Can this be done?

Regards

Look up in the docs dba/all/user_tab_columns data dictionary view

Best regards

Maxim
Besides the dba_tab_columns view that Maxim pointed out there are
other language specific features available such as the OCI interface
call OCIDescribeAny and the dbms_describe package. Depending on your
front-end tool set a direct query may or may not be the method you
want to use.

HTH -- Mark D Powell --

Reply With Quote
  #4  
Old   
sandeep pande
 
Posts: n/a

Default Re: Select statement that returns field size? - 05-11-2010 , 02:10 AM



On May 5, 11:05*pm, Rich <richma... (AT) earthlink (DOT) net> wrote:
Quote:
I am using 10g.

I want to do a select statement that will give me the name of the
fields in a table. And I also want to know the field type and field
size.

Can this be done?

Regards
Hi,

Yes u can do this using

SQL> desc dba_tab_columns
Name Null? Type
----------------------------------------------------- --------
------------------------------------
OWNER NOT NULL
VARCHAR2(30)
TABLE_NAME NOT NULL
VARCHAR2(30)
COLUMN_NAME NOT NULL
VARCHAR2(30)
DATA_TYPE
VARCHAR2(106)
DATA_TYPE_MOD
VARCHAR2(3)
DATA_TYPE_OWNER
VARCHAR2(30)
DATA_LENGTH NOT NULL NUMBER
DATA_PRECISION NUMBER
DATA_SCALE NUMBER
NULLABLE
VARCHAR2(1)
COLUMN_ID NUMBER
DEFAULT_LENGTH NUMBER
DATA_DEFAULT LONG
NUM_DISTINCT NUMBER
LOW_VALUE
RAW(32)
HIGH_VALUE
RAW(32)
DENSITY NUMBER
NUM_NULLS NUMBER
NUM_BUCKETS NUMBER
LAST_ANALYZED DATE
SAMPLE_SIZE NUMBER
CHARACTER_SET_NAME
VARCHAR2(44)
CHAR_COL_DECL_LENGTH NUMBER
GLOBAL_STATS
VARCHAR2(3)
USER_STATS
VARCHAR2(3)
AVG_COL_LEN NUMBER
CHAR_LENGTH NUMBER
CHAR_USED
VARCHAR2(1)
V80_FMT_IMAGE
VARCHAR2(3)
DATA_UPGRADED
VARCHAR2(3)
HISTOGRAM
VARCHAR2(15)

select table_name,column_name,data_type,DATA_LENGTH from
dba_tab_columns where table_ name='<table_name>' and owner='<username>'

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.