Skip to Main Content
  • Questions
  • data_precision and data_scale in user_tab_columns

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, sekhar.

Asked: May 18, 2005 - 9:34 pm UTC

Last updated: May 19, 2005 - 1:20 pm UTC

Version: 9.2.0.6

Viewed 1000+ times

You Asked

Tom,

CREATE TABLE GEN_DUMMY
(
COL1 NUMBER(7,2),
COL2 DATE,
COL3 VARCHAR2(20 BYTE),
COL4 NUMBER(9),
COL5 NUMBER, ----- precision and scale not defined.
COL6 NUMBER
)

COLUMN DATA_TYPE FORMAT A10
COLUMN DATA_LENGTH FORMAT 99
select data_type, data_length, data_precision, data_scale
from user_tab_columns
where table_name = 'GEN_DUMMY'
DATA_TYPE DATA_LENGTH DATA_PRECISION DATA_SCALE
---------- ----------- -------------- ----------
NUMBER 22 7 2
DATE 7
VARCHAR2 20
NUMBER 22 9 0
NUMBER 22
NUMBER 22



As you can see the data_precision and data_scale are populated
only if the number(p,s) is specified. If the data_type is given as only number(no precision and scale are defined), then it is null.
How do I populate data_precision and scale in such a situation.

I want to display the default values in data_precision and data_scale if the datatype is number(no precision and scale defined when creating the table).

I tried to use decode but other fields are also getting populated.

thanks for the help

sekhar


and Tom said...

the precision and scale are slidable if not defined -- they *have* no set precision and scale.

you can store

900000000000000000000000000000000000000
or
.000000000000000000000000000000000000009

in there -- you simply have "38 digits", there are no values you could put in there to allow this -- you have to leave them blank.


Is this answer out of date? If it is, please let us know via a Comment