Someone know oracle decimal fraction conversion?

Asked By 10 points N/A Posted on -
qa-featured

Hi Experts,

I am having oracle on my laptop.I need to know about oracle decimal fraction conversion.Any database expert advice me.I tried some commands but I am not expert in database area.Thanks.

Regards,

Matland Maut

SHARE
Answered By 10 points N/A #133633

Someone know oracle decimal fraction conversion?

qa-featured

Hello Matland,

You can for sure be able to decimal numbers to fractions in oracle. The following is an SQL code that will help you will that process:

SQL> create or replace
  2  function formula_to_number(p_formula in varchar2) return number as
  3     l_formula varchar2(30);
  4     l_result  number;
  5  begin
  6     l_formula := replace(p_formula,' ','+');
  7     execute immediate 'select ' || l_formula || ' from dual' into l_result;
  8     return l_result;
  9  end;
10  / 
 
Function created.
 
SQL> select formula_to_number('2 3/4') from dual;
 
FORMULA_TO_NUMBER('23/4')
-------------------------
                     2.75

Regards,

Carl

Related Questions