number format conversion

Hello

I have an external table that uses German digital format.

either 100.00 would be 100.00 in English.

Let's say the data is helping the GE_CSV table.

SELECT GE_CSV RECIPES

Returns:

100.00
200.00
300.00

etc.

What is the best way to convert it to an English number format.

Best regards
Adam
SQL> with t as (
  2             select '1,00' revenue_str from dual union all
  3             select '10,00' from dual union all
  4             select '100,00' from dual union all
  5             select '1000,00' from dual union all
  6             select '10000,00' from dual union all
  7             select '100000,00' from dual
  8            )
  9  select  revenue_str,
 10          to_char(to_number(revenue_str,'99999999D9999','nls_numeric_characters=,.'),
 11                  '99999999D99','nls_numeric_characters=.,') revenue_num
 12    from  t
 13  / 

REVENUE_S REVENUE_NUM
--------- ------------
1,00              1.00
10,00            10.00
100,00          100.00
1000,00        1000.00
10000,00      10000.00
100000,00    100000.00

6 rows selected.

Or simply this:

SQL> with t as (
  2             select '1,00' revenue_str from dual union all
  3             select '10,00' from dual union all
  4             select '100,00' from dual union all
  5             select '1000,00' from dual union all
  6             select '10000,00' from dual union all
  7             select '100000,00' from dual
  8            )
  9  select  revenue_str,replace(revenue_str,',','.') revenue_num
 10    from  t
 11  / 

REVENUE_S REVENUE_N
--------- ---------
1,00      1.00
10,00     10.00
100,00    100.00
1000,00   1000.00
10000,00  10000.00
100000,00 100000.00

6 rows selected.

Max
[My Italian blog Oracle | http://oracleitalia.wordpress.com/2010/01/23/la-forza-del-foglio-di-calcolo-in-una-query-la-clausola-model/]

Tags: Database

Similar Questions

  • All excel cell number format using "excel cell format.vi set.

    Hi all

    I am writng 12 numbers to Excel cell, but it seems to me that 2.00207E + 11 instead of 200207106040. I use entire excel function cell phone format.vi but it is not useful, because I have no number format...

    Reference in the image file setting a VI.

    Thank you

    Got the answer.

  • Column/data varchar but req number formatting when digital.

    Hello

    I wrote some sql to retrieve data from our Oracle database.

    Number formatting is a bit unfortunate.

    The column reads:

    1 000 000

    0.010

    1 000

    0.0009

    9999999.000

    -

    null

    > NWG

    If its not all of the numbers, but if it is a number, I need to correctly format i.e.

    without decimal places if they are just led 0

    I hope that there is a regular expression that I can use to format numbers ignoring the character entries.

    Any suggestions?

    Hello

    Whenever you have a question, please post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the accurate results you want from this data, so that people who want to help you can recreate the problem and test their ideas.

    Explain, using specific examples, how you get these results from these data.

    Always say what version of Oracle you are using (for example, 11.2.0.2.0).

    See the FAQ forum: Re: 2. How can I ask a question on the forums?

    What do you mean by "if it's a number"?  The following could all be considered numbers:

    • -1
    • -1.2E + 3
    • $9,987,54
    • 123 456,7
    • 3/4

    Depending on what you consider a 'number', you can use expressions regular, perhaps combined with other string manipulation functions, like to TRANSLATE.

    You can consider a function defined by the user who tries to convert it to a NUMBER, but never to raise an error.  See How to determine if a Varchar2 string has characters from a to z?

    Which type of formatting you want for the numbers?  You said that you don't want to end ' 0 decimal, but how about a trailing decimal point?  When you post the sample data and results, examples of all individual cases, you want to manage.

    You may need TO_CHAR and then some channel, for example, RTRIM or REGEXP_REPLACE mainpulation functions.

    As you realize you probably now, it's a really bad design.  You let people in chains that may or may not represent the numbers, then, much later, trying to guess the whehter they meant it to be number, and if so which COMP.  Guess, isn't a very good way to solve problems.  The person who knows the data if it is a number or not - make him tell you at the point where it enters the number.  For example, instead of having 1 VARHCAR2 column, you may have 2 columns (a VARCHAR2 and a NUMBER) and a CHECK constraint that requires at least 1 of them to be null.

  • Model number format comma and dot (.) appear as 'u' a bad

    When I saw the pdf at the local level, the number worked well, for example '1000'-> '1 '000.00 '.

    But I run in eBS, the number format do not work, for example, '1000'-> '1u000n00 '.
    I put the number as format below:
    <? format-number: SUM_AMOUNT_D; '9G999G999G999G999D99 '? >

    I also change the format of '9G999G999G999G999D99' to ' #, #, #, #, #. 00'. it still does not work.

    Help, please

    Thank you

    KP

    Model number format comma and dot (.) appear like 'u' and ' don't (Doc ID 760434.1)

  • I'm looking for a list of commands/syntax for number formatting. Example of ^ 1, ^ #, ^ t, etc...

    I'm trying to find a list of command/syntax that can be used in number formatting (bullets and numbering - style - dial number field).  I found a few examples, but I keep a list of available commands.  I searched, but was unable to find it.  Presumably, I'm using the wrong search terms.

    I don't think, because these are only a few. In the automatic numbering of the paragraph style settings dialog box, you have a drop down menu where you can select the formats that are then entered in the form of these shortcuts.

  • Number formatting Question

    Hi all..

    Please help with this question number formatting.

    I think that this question could have asked a lot of time, but I could not able to find the answer.

    I would format a number with 3 decimal places

    I mean.

    Ex:

    123456 to 123456.000

    12.1 to 12,100

    12.12 to 12.120

    12.123 to 12.123

    12.1234 to 12.123

    1234.12345 to 1234.123

    Please help me with this.

    Thank you

    Use TO_CHAR and mask format:

    SQL> -- generating sample data:
    SQL> with t as (
      2  select 123456 n from dual union
      3  select 12.1 from dual union
      4  select 12.12 from dual union
      5  select 12.123 from dual union
      6  select 12.1234 from dual union
      7  select 1234.12345 from dual
      8  )
      9  --
     10  -- actual query:
     11  --
     12  select n
     13  ,      to_char(n, '999999d000') c
     14  from   t;
             N C
    ---------- -----------
          12.1      12.100
         12.12      12.120
        12.123      12.123
       12.1234      12.123
    1234.12345    1234.123
        123456  123456.000
    6 rows selected.
    
  • In RTF model number format

    Hello

    I have a form field on a RTF model and its value is a number positive or 0.
    I see positive numbers in braces and zero strapless.


    The number Format that I use at the moment (#, # 0.00), which is also puts braces around zero.

    Here is an example of how I need to display the positive numbers and zero.


    Example:

    Value: 201.53
    Display: (201.53)

    Value: 0
    Display: 0.00


    Thank you
    Yogi

    Published by: user3209802 on February 21, 2013 22:03

  • Custom number format function does not return 0 in decimal form

    Hello

    My custom number formatting feature does not work. It was working fine when the site has a standard client server architecture. However, when we changed using the REST API with javascript and HTML 5 function works for most except in cases when I need it displays 0 for decimal numbers.

    Basically, the function accepts arguments a number and the number of decimals and returns the number rounded the number of decimals. Below, I've stripped naked function minimum, even I was testing.

    < cffunction = "dispCostPeriod" access = "remote" returntype = "string" output = "false" hint = "name costs for a specified period at the user" >

    < name cfargument = "in_decCost" type = "numeric" required = "yes" / >

    < name cfargument = "in_iRound" type = "numeric" required = "yes" / >

    < cfset decRoundedNum = NumberFormat (in_decCost, "_" & RepeatString("9",in_iRound)) >

    < cfreturn decRoundedNum / >

    < / cffunction >

    When I pass 55.00089 and 3, the function returns 55.001.

    When I was 55 or 55.000000 or 55.0000089 and 3, the function returns 55

    . And I need to 55,000.

    I tried both for returntype 'string' and 'digital', various masks as _.999, _.000, _. ___.

    I tried NumberFormat (in_decCost, "_.000") straight back.

    Nothing works.

    I use CF10 on Windows Server 2008.

    Any help much appreciated.

    Thank you

    Gena

    Can you explain how the data gets into the browser as a JSON string format?

  • Showing the positive sign as the number Format

    Hi all

    Is it possible to set the number format (custom format) to show the positive with the positive (+) sign numbers in front of the number (for example, + 2, + 2.3 + 0,0, etc.).

    I don't want to ride the number as a string and perform a concatenation. So, is it possible to do this using a custom number format?

    Thank you very much!

    Hello

    You can try to use the custom format and specify as below:
    +#,###;-#,###

    I tried this in 10g and seems to work very well.

    Thank you
    Hyder

  • Number format not valid in the data transfer Assistant

    I'm trying to download data from a CSV file in a table via the download data wizard. However, it always seems to fail on some lines with an error "invalid number format". Even if I stick one of these lines in the wizard, it still does not work. There is nothing wrong with the data, and I can do a regular insert Toad with no problems.

    The data are:
    28126238,101, RM, 29/01/2011

    The table looks like this:
    CREATE TABLE STR_PROD_UPLOAD
    (
    NUMBER OF PROD_CD,
    NUMBER OF STORE_CD
    CHARACTER VARCHAR2 (10 BYTE),
    DATE OF REPL_START_DT
    )

    It works very well on Toad:
    INSERT INTO STR_PROD_UPLOAD)
    STORE_CD,
    PROD_CD, line, repl_start_dt)
    VALUES (to_number('101'), to_number('28126238'), 'RM', to_date('1/29/2011','MM/DD/YYYY'));

    Anyone have any ideas on what might be wrong or how I can go about the matter of finding?

    FYI - evolution STORE_CD of a varchar2 and PROD_CD solves the problem, but I would like to know if it is possible to solve this problem for later use.

    Thx John

    Hi John,.

    For some reason, I get the same error. However with the download of the data, you can still provide you own number format in the case where the application could not a defined automatically. In your case, using Date / field number Format (for example: 99999999) will force the system to use the supplied format.

    Concerning
    Patrick

  • How to use FM format in the model number format

    Hi all
    Anyone could explain what is the element format FM for model number format? I've read the documentation, it does not show a clear description that it the section model Format Datetime.

    Kind regards
    Valerie

    What is the element format FM for model number format?

    It removes the space left is allocated for additional info, for example a sign:

    SQL> select length(to_char(0, '0')) len1, length(to_char(0, 'fm0')) len2 from dual
    /
               LEN1            LEN2
    --------------- ---------------
                  2               1
    1 row selected.
    
  • Number format for a thousand

    Hello

    I have a feature attribute of type BigDecimal with the type value equal to the number format.
    Its format string is ' # # 0.00' (for the thousand characters '' instead of' ' value), but on the record, there is no space on outputText or inputText.» How can I have the desired rendering?

    What I suggested was to use a comma in your af:convertNumber (model = "#, # 0.00") and change the group number trinidad-config.Xml file separator.

    If you don't want space as a separator of grouping in the world, you can write your own number converter (not difficult).

    John

  • Apex: Number Format

    How to remove the comma from number format * 99G99G99G99G90D000 * in the Apex?

    Yogesh

    To remove the commas, remove all G, for example. 9999999990D 000.

    If you want to remove the decimal, remove the D, for example. 99G99G99G99G90.

    Elsie

  • Please help, convert this string to a number format

    I send orders via RS232 to my machine and the machine sent back with a display of the number "40" in display normal in my image attatched. I tried to use the string conversion to digital tools, but there is nothing happen just '0 '.

    I wondered with it, then I try output string in a different way as in attached code, display and hex display and see the format of it.

    I want to get the string '40' to take the number, how can I get it? Help, please

    Thank you in advance.

    It has worked well for me. Just to be on the safe side, you can use the Trim function spaces (channels palette) to clear the characters "\".

    Steve

  • varchar2 to the date format conversion

    I have converted the formats of date several times, but for some reason, I get an error invalid number when you try to convert a varchar2 column. I tried the to_char and to_date function and I get the same result. The column is a date and it is formatted like ME-DD-YYYY, but I want to change it to DD/MM/YYYY. My query is below:

    Select to_date('fccpdate','MM/DD/YYYY')
    of cc_class_scmast_v

    When I try to_date I get this:

    Error from the 1 in the command line:
    Select TO_DATE ('fccpdate ',' MON-DD-YYYY "") of cc_class_scmast_v, where fccpdate IS NOT NULL
    Error report:
    SQL error: ORA-01858: a non-digit character was found here where was waiting for a digital
    01858 00000 - "a non-digit character found here where was waiting for a digital".
    * Cause: Input data to convert using a date format model has been
    incorrect answer. The input data did not contain a number where is a number
    required by the format model.
    * Action: Fix the input data or the date format model to ensure that the
    elements correspond to the number and the type. And then try the operation again.



    When I try to_char I get this:

    Error from the 1 in the command line:
    Select TO_char ('fccpdate ',' MON-DD-YYYY "") of cc_class_scmast_v, where fccpdate IS NOT NULL
    Error report:
    SQL error: ORA-01722: invalid number
    01722 00000 - "invalid number."
    * Cause:
    * Action:


    I tried to remove the single quotes of my column and that does make a difference. Any help is appreciated.

    Hello

    housetiger77 wrote:
    I have converted the formats of date several times, but for some reason, I get an error invalid number when you try to convert a varchar2 column. I tried the to_char and to_date function and I get the same result. The column is a date and it is formatted like ME-DD-YYYY,

    If the column is a DATE, then it has the same format that all DATEs, which is nothing like 'DD-MON-YYYY '. Formats like which apply only to chains.
    Conversely, if it is in the format "DD-MON-YYY", then it is a string, not a DATE.

    but I want to change to DD/MM/YYYY. My query is below:

    Select to_date('fccpdate','MM/DD/YYYY')
    of cc_class_scmast_v

    To_date (x, "MM/DD/YYYY") tries to convert the string x in a DATE. Let's say it starts by taking the first 2 characters of x, for the month. The first 2 characters of 'fccpdate' are "fc", which is not a valid number (at least not in base 10), not to mention a number from 1 to 12, TO_DATE so will raise an error.

    When I try to_date I get this:

    Error from the 1 in the command line:
    Select TO_DATE ('fccpdate ',' MON-DD-YYYY "") of cc_class_scmast_v, where fccpdate IS NOT NULL
    Error report:
    SQL error: ORA-01858: a non-digit character was found here where was waiting for a digital
    01858 00000 - "a non-digit character found here where was waiting for a digital".
    * Cause: Input data to convert using a date format model has been
    incorrect answer. The input data did not contain a number where is a number
    required by the format model.
    * Action: Fix the input data or the date format model to ensure that the
    elements correspond to the number and the type. And then try the operation again.

    When I try to_char I get this:

    Error from the 1 in the command line:
    Select TO_char ('fccpdate ',' MON-DD-YYYY "") of cc_class_scmast_v, where fccpdate IS NOT NULL
    Error report:
    SQL error: ORA-01722: invalid number
    01722 00000 - "invalid number."
    * Cause:
    * Action:

    I tried to remove the single quotes of my column and that does make a difference. Any help is appreciated.

    It's a good first step. Literals are enclosed in single quotes are not identifiers (including the column names). "fccpdate" is the literal string of 8 characters containing 'f', ' c; Another 'c', 'p' 'd', 'a', 't' and 'e'. " fccpdate (without the single quotes) can be the name of a column.

    If fccpdate is a string, as July 18, 2012', then you can convert it to a DATE using TO_DATE.

    TO_DATE (fccpdate, 'DD-MON-YYYY')
    

    If you want to display a DATE in a particular format, use

    TO_CHAR ( d
            , f
            )
    

    where d is a DATE, and f is the format string. In this case, d is perhaps the TO_DATE expression above

    TO_CHAR ( TO_DATE (fccpdate, 'DD-MON-YYYY')
            , 'MM/DD/YYYY'
            )
    

    I hope that answers your question.
    If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data.
    Explain, using specific examples, how you get these results from these data.
    Always tell what version of Oracle you are using.
    See the FAQ forum {message identifier: = 9360002}

Maybe you are looking for