Difference between number and integer datatype in oracle dictionary views

后端 未结 3 1664
傲寒
傲寒 2020-12-08 06:45

I used oracle dictionary views to find out column differences if any between two schema\'s. While syncing data type discrepancies I found that both NUMBER and INTEGER data t

3条回答
  •  一整个雨季
    2020-12-08 07:12

    Integer is only there for the sql standard ie deprecated by Oracle.

    You should use Number instead.

    Integers get stored as Number anyway by Oracle behind the scenes.

    Most commonly when ints are stored for IDs and such they are defined with no params - so in theory you could look at the scale and precision columns of the metadata views to see of no decimal values can be stored - however 99% of the time this will not help.

    As was commented above you could look for number(38,0) columns or similar (ie columns with no decimal points allowed) but this will only tell you which columns cannot take decimals, and not what columns were defined so that INTS can be stored.

    Suggestion: do a data profile on the number columns. Something like this:

     select max( case when trunc(column_name,0)=column_name then 0 else 1 end ) as has_dec_vals
     from table_name
    

提交回复
热议问题