Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: TO_NUMBER and NUMBER(n,m)

Re: TO_NUMBER and NUMBER(n,m)

From: Jurij Modic <jurij.modic_at_mf.sigov.mail.si>
Date: 1997/09/24
Message-ID: <34298d4a.10474091@www.sigov.si>#1/1

On 24 Sep 1997 07:29:27 -0700, Jeff Boes (jboes_at_qtm.net) wrote:

>I'm almost embarassed to ask this, but hey, I'm a C programmer, not a COBOL
>programmer.
>
>A new database includes NUMBER(7,1) and other such fields. I'm writing Pro*C
>code to insert values, which are coming from a mainframe and look like this:
>
>'0000731' -> representing 73.1
>
>I've been trying things like
>
>... TO_NUMBER(:myValue, 'FM099999V9')
>... 'FM999999.9'
>... 'FM09999999'
>
>etc., etc. In short, various combinations of 'V', '.', leading zeroes, 7-digits,
>6-digits. I've dug through the documentation and just plain don't get it. Can
>anyone offer some quick help as to how this is done?

I don't think you can "insert" a decimal point into your given string unles you want to use SUBSTR function. If the precision and scale of your values is fixed then the simpliest solution should be to devide the integer representation with fixed decade, ie in your example:

SQL> select to_number('0000731','9999999')/10 RESULT from dual;

   RESULT


     73.1

Maybe you even don't need any format mask:

SQL> select to_number('0000731')/10 RESULT from dual;

   RESULT


     73.1

Regards,


Jurij Modic                             Republic of Slovenia
jurij.modic_at_mf.sigov.mail.si		Ministry of Finance
============================================================
The above opinions are mine and do not represent any official standpoints of my employer Received on Wed Sep 24 1997 - 00:00:00 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US