AloNE
AloNE

Reputation: 311

how to get size of table field trough oracle Query

I want to get size of Oracle table field(Column), I try below query

 select data_type, data_length 
  from user_tab_columns
 where table_name = 'CRM_CHANGE_REQ'
   and column_name = 'RNO';

it gives 22 but real size is 4,so give suggestion what can i do?

Upvotes: 2

Views: 8625

Answers (1)

rags
rags

Reputation: 2590

Check http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:10153966194688

DATA_LENGTH column stores maximum length in bytes required to store values for a datatype of a given column.

For NUMBER it is always 22 bytes, regardless of the precision and scale (1 byte for exponent, 20 bytes for a mantissa and 1 byte for negative sign).

For NUMBER datatype you should look at DATA_PRECISION and DATA_SCALE columns if you want to find the precision and scale defined for a column.

Upvotes: 2

Related Questions