Displaying Zero
I need to get the values that retain one zero on the left of the decimal, and dont have any trailing zeroes at the end on right of a decimal?
create table test_num(num number);
insert into test_num values(1);
insert into test_num values(0.7);
insert into test_num values(0.187);
insert into test_num values(1.2);
commit;
select * from test_num;
SQL> select * from test_num;
NUM
----------
1
.7
.187
1.2
To get the zeroes as needed, I can query as below:
select decode(instr(num,'.'),1,'0'||num,num) from test_num;
DECODE(INSTR(NUM,'.'),1,'0'||NUM,NUM)