I was trying to extract data length for all numeric columns in my database from the user_tab_columns view.
I found a very surprising thing. The data_length we get by desc statement is entirely different from the data_length field in the user_tab_columns. Basically for all numeric fields the data_length is always 22 in the view. What does the data_length field in the user_tab_columns give us??!!!
Eg: Observe the Due_adj_amt field from Desc statement
COLUMN_NAME DATA_TYPE DATA_LENGTH
CURR_CD VARCHAR2 8
DUE_ADJ_AMT NUMBER 17
CATEGORY_DESC VARCHAR2 100
SYSTEM_FIX CHAR 1
SCRUBBED CHAR 1
and the due_adj_amt data_length from the user_tab_columns view:
Thanx in advance,
Put simply, I dont know what the 22 is all about
to measure number lengths
the 15 is stored in the data_precision column
the 2 is stored in the data_scale column
also data_length gives you the character length of
However this is only based on limited knowledge.
Click Here to Expand Forum to Full Width