Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: help with syntax
Try this:
select data_type||
decode(data_type,'RAW' ,decode(data_length,null,null/
,'('||data_length||')')
,'CHAR' ,decode(data_length,null,null
,'('||data_length||')')
,'VARCHAR' ,decode(data_length,null,null
,'('||data_length||')')
,'VARCHAR2',decode(data_length,null,null
,'('||data_length||')')
,'NUMBER' ,decode(data_precision,null,' ' ,'('||data_precision|| decode(data_scale,null,null,','||data_scale)||')') ,'FLOAT' ,decode(data_precision,null,' ' ,'('||data_precision|| decode(data_scale,null,null,','||data_scale)||')') ,null) from user_tab_columns where table_name='EMP'
It will cover basically all type of datatypes. If you only need for varchar2, it will much simpler. Here is the display from above query.
NUMBER(4,0)
VARCHAR2(10)
VARCHAR2(9)
NUMBER(4,0)
DATE
NUMBER(7,2) NUMBER(7,2) NUMBER(2,0) ______________________________
"Daniel A. Morgan" <Daniel.Morgan_at_attws.com> wrote in message news:<3B83E8AE.8E30155D_at_attws.com>...
> bullseye wrote: > > > What syntax shows data_type and data_length as: varchar2(30)? Where do I > > concatenate? Where do I use strings? (Do I need to?) > > > > I am querying user_tab_columns. > > > > thank you. > > None. > > What you would need to do is two complex for a simple query. For example when > the data_type is DATE the data_length is listed as 7. > > You likely would not want to concatenate together DATE(7). > > Daniel A. MorganReceived on Thu Aug 23 2001 - 09:05:28 CDT