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

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Can TO_NUMBER Do This?

Re: Can TO_NUMBER Do This?

From: <nlzanen1_at_ey.nl>
Date: Mon, 28 Aug 2000 21:59:37 +0200
Message-Id: <10602.115673@fatcity.com>


hi

Try a combination of replace and to_number

to_number(replace(<column>,'()')) (of the top of my head)

jack

Ed Bittel <ebittel_at_yahoo.com>@fatcity.com on 08/28/2000 09:26:27 PM

Please respond to ORACLE-L_at_fatcity.com

Sent by: root_at_fatcity.com

To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com> cc:
Subject: Can TO_NUMBER Do This?

Against the repeated urging of the DBA (me), a developer insisted on creating all the numeric columns of his new appliction's tables as VARCHAR2. (Don't ask me why! I've explained it to him several times to no avail.)

Problem



Negative values are represented in the tables with parenthesis
(e.g., '(34,989.89)'). He needs to convert these character
values to numeric so he can do some math.

I know you can parenthesize values when doing a TO_CHAR like this:

   select to_char(f1,'999D99PR') from test where f1=-123.45

   TO_CHAR(



   <123.45>

However, if this doesn't appear to work with the to_number function, at least in my case.

Any ideas how to convert at string like '(1,234.87)' to a numeric value?

-Ed



Do You Yahoo!?
Yahoo! Mail - Free email you can access from anywhere! http://mail.yahoo.com/
--
Author: Ed Bittel
  INET: ebittel_at_yahoo.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L

(or the name of mailing list you want to be removed from). You may
also send the HELP command for other information (like subscribing). =================================================================== De informatie verzonden met dit E-mail bericht is uitsluitend bestemd voor de geadresseerde. Gebruik van deze informatie door anderen dan de geadresseerde is verboden. Openbaarmaking, vermenigvuldiging, verspreiding en/of verstrekking van deze informatie aan derden is niet toegestaan. Ernst & Young staat niet in voor de juiste en volledige overbrenging van de inhoud van een verzonden E-mail, noch voor tijdige ontvangst daarvan. =================================================================== The information contained in this communication is confidential and may be legally privileged. It is intended solely for the use of the individual or entity to whom it is addressed and others authorised to receive it. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is strictly prohibited and may be unlawful. Ernst & Young is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its
Received on Mon Aug 28 2000 - 14:59:37 CDT

Original text of this message

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