oracle11g - Force decimal value, even when 0 in oracle -


i have field stores version information such 1.1, 1.2 etc. however, store 4.0 4 , 5.0 5.

is there way force show .0?

i have tried number(5, 3) , decimal(5, 3) data types , neither work.

version - oracle database 11g enterprise edition release 11.2.0.2.0 - 64bit production

a number column never store decimal value if doesn't need to.

you can, however, control how data displayed user when converted string using explicit to_char rather relying on implicit data type conversion. if use format mask 9.0 in to_char call, example, string generated have 1 decimal digit.

sql> select to_char( 4, '9.0' )   2    dual;  to_c ----  4.0  sql> ed wrote file afiedt.buf    1  select to_char( 4.1, '9.0' )   2*   dual sql> /  to_c ----  4.1 

that being said, seems unlikely want store software version information in number column rather varchar2. you, presumably, aren't doing mathematical operations on data of benefit of having number off table. , software versions not inherently numeric. find wanting more 2 components (i.e. oracle 11.2.0.1). , software versions tend have highly non-numeric things done them. if version follows 4.9 4.10, that's different version 4.1 followed 4.0. if you're using number, though, lose ability differentiate between versions.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -