You can try to cast to float:
create or replace table test (a NUMBER(38,12));
insert into test values (0.97821915), (0.650502591918), (0.975479450000);
select a from test;
+----------------+
| A |
|----------------|
| 0.978219150000 |
| 0.650502591918 |
| 0.975479450000 |
+----------------+
select a::float from test;
+--------------+
| A::FLOAT |
|--------------|
| 0.97821915 |
| 0.6505025919 |
| 0.97547945 |
+--------------+
However, depending what you want to achieve, using floating number might not be a good idea due to potential rounding issues.
UPDATE:
I tried the regexp version, not sure if I missed any test case or not:
create or replace table test (a NUMBER(38,12));
insert into test values
(0.97),
(0.650502591918),
(0.975479450000),
(10000),
(1450000),
(12.2000),
(14.0200);
select regexp_replace(
a::varchar,
'^([0-9]+)$|' ||
'^([0-9]+)\.0*$|' ||
'^([0-9]+\.[0-9]{1,}[1-9])0*$|' ||
'^([0-9]+\.[1-9])0*$', '\\1\\2\\3\\4'
) as a from test;
+----------------+
| A |
|----------------|
| 0.97 |
| 0.650502591918 |
| 0.97547945 |
| 10000 |
| 1450000 |
| 12.2 |
| 14.02 |
+----------------+
Where:
^([0-9]+)$ -> will cover the integer like 10000
^([0-9]+)\.0*$ -> will cover integer like 10.000000
^([0-9]+\.[0-9]{1,}[1-9])0*$ -> will cover 14.0200000
^([0-9]+\.[1-9])0*$. -> will cover 12.20000 or 0.97540000