INTEGER = NUMBER(38)
I noticed something a little strange today.
I've recently been creating tables with as specific a data type as I could. In that regard, I've been using INTEGER.
CREATE TABLE t
(
x INTEGER
);
Do a describe on that table:
CJUSTICE@TESTING>@DESC T
Name Null? Type
-------------------------------------- -------- ------------
X NUMBER(38)
Running a query on USER_TAB_COLUMNS results in this:
SELECT
data_type,
data_type_mod,
data_length,
data_precision,
data_scale,
default_length
FROM user_tab_columns
WHERE table_name = 'T'
AND column_name = 'X';
DATA_TYPE DAT DATA_LENGTH DATA_PRECISION DATA_SCALE DEFAULT_LENGTH
---------- --- ----------- -------------- ---------- --------------
NUMBER 22 0
The describe says NUMBER(38) yet USER_TAB_COLUMNS says NUMBER(22). Weird.
When I view the object through the SQL Developer schema browser and go to the SQL tab I get this:
CREATE TABLE "CJUSTICE"."T"
(
"X" NUMBER(*,0)
);
So Oracle converts it somewhere along the way?
Further, going to the source of DBA_TAB_COLUMNS took me to DBA_TAB_COLS, I really thought it was the other way around, but I digress. I began to look at the source from DBA_TAB_COLS which had many staring at all of the SYS tables. OBJ$. COL$. HIST_HEAD$. USER$. COLTYPE$. I then started to try to unravel that...but I stopped.
It obviously won't stop me from doing my work, I just found it interesting. It's similar to
A NULL Observation, III.
Labels: database, oracle, oradb