Convert commas to decimal in oracle

I have source table as
create table test
LoadId Number(10),
Data varchar2(5)
LoadID has inceremental values for 1,2,3,.....
Data has values as given below
2
0,5
1.5
2,5
0
0
0
2,5
1
1,5
0,5
1,5
1,5
0,5
I want to select values from data field but while selecting i want to covert them to number datatype i.e. commas will be converted to decimal points.
So needed values will be like
2
0.5
1.5
2.5
0
0
0
2.5
1
1.5
0.5
1.5
1.5
0.5
How can i achieve this ?

select to_number(data,'999D99','nls_numeric_characters = '',.''') from test;?

Similar Messages

  • Decimal of SQL Server getting converted to Whole number in ORACLE

    Hi All,
    I am using ORACLESQL Developer tool to migrate database from SQL Server to ORACLE. The decimal datatype in Sql Server is not getting converted to its equivalent in ORACLE. Do anyone face the same problem? Its getting converted to WHOLE number.
    Also I am able to import data only from Excel sheet. Is therre any other option to import data using this tool?
    Also is the tool the best to use for migration? Please give me your suggestions pls since I am facing this conversion problem after import lakhs of data.
    I am using version 1.1.3
    Thanks in Advance,
    Srinivasan.T

    I have upgraded to the version mentioned by you. Even now it is not getting upgraded. I am exporting data using Excel sheet only. Is it possible for you to explain how to migrate data thru SQL * PLUS?
    Thanks,
    Srinivasan.T

  • Need to Convert Comma separated data in a column into individual rows from

    Hi,
    I need to Convert Comma separated data in a column into individual rows from a table.
    Eg: JOB1 SMITH,ALLEN,WARD,JONES
    OUTPUT required ;-
    JOB1 SMITH
    JOB1 ALLEN
    JOB1 WARD
    JOB1 JONES
    Got a solution using Oracle provided regexp_substr function, which comes handy for this scenario.
    But I need to use a database independent solution
    Thanks in advance for your valuable inputs.
    George

    Go for ETL solution. There are couple of ways to implement.
    If helps mark

  • Convert Mainframe Packed Decimal to Oralce Number Format

    Dear all,
    I am having a file in which amount fields are given in a Packed Decimal format. Can anyone suggest me how I can read this data element from the file and convert it into Oracle Number datatype.
    File is a fixed length. All the amount fields are given in Packed Decimal Format and rest of the fields are given in text format.
    Thanks and regards
    Nagasayan Puppala

    Hi,
    Firstly thanks for your reply.
    Actually I am not using SQL Loader to load data from
    a flat file to Oracle table. I am writing a custom
    program that reads the file and populates the oracle
    table. I'll put aside the question of 'why' you'd want to do that. SQL*Loader's singular purpose in life is to load flat files of data into Oracle DB. Sometimes there is a reason for reinventing the wheel.
    How does your program communicate with the Oracle DB? If utilizing ESQL and Pro*Cobol (or Pro*<whatever> ) you will have read the data into a variable of some type in you host language. The variable of the host variable to hold the value (if you did a 'select from' that table) would be the correct target type for an insert statement. Whatever host language type conversion is available bewteen those two types ( if they are different at all ) is all that is needed. The precompilers have converters between certain native host and internal Oracle types built-in. It is how you get any data between the two systems. This is only a problem if the host language has no converter between the numeric types (if differnet.). When you read from the flat file are you reading it into a native packed decimal in the host language?
    ODBC/JDBC similar strategy..... cast conversion between the native type that Oracle wants and the one into which your custom program reads it into.
    So I want to know whether there are any Oracle
    utility programs that will convert the packed decimal
    to a oracle number format or not.There are Oracle routines that convert into the native Oracle DB formats. There are implicitly available through the normally utilized interfaces to OCI ( ESQL and ODBC/JDBC ) . There are none decoupled from those interfaces though (that I know of).
    There are no standalone programs that mutate a flat file into another flat file that then could be loaded. That's is typically slower and utilzes more space than most customers want than just directly inputing the data into Oracle DB.
    Message was edited by:
    lytaylor

  • Report Parameter - Comma as Decimal Separator

    Post Author: Jóhan E. M. J. Sivertsen
    CA Forum: General
    I want to use comma as decimal separator in Crystal Reports Server XI.
    When designing the report in CR Professional (version 11.0.0.1994), my report both displays and understand comma as decimal separator when filtering with a parameter.
    When running the same report in CR Server XI InfoView, the report correctly displays numbers with comma (,) as decimal separator, but the parameter uses dot/point (.) as decimal separator.
    The report runs against Oracle 10g database.
    Regional and Language Options is set to Danish (comma as decimal separator) on both my Windows XP PC (running CR Professional) and the Windows Server 2003 SP2 (running CR Server XI).
    NLS_LANG is set to DANISH_DENMARK.WE8MSWIN1252 (comma as decimal separator) in the Windows registry. &#91;HKEY_LOCAL_MACHINESOFTWAREORACLEKEY_OraClient10g_home1&#93;"NLS_LANG"="DANISH_DENMARK.WE8MSWIN1252"
    The report parameters are written directly in the query "command" in the CR database expert.
    Why does the CR Server uses dot/point (.) as decimal separator in the parameter when CR Professional on my PC uses comma (,) as decimal separator in the parameter?
    Is it possible to change this, so CR Server (CR InfoView) uses comma as decimal separator? If so, how? Please remember that the numbers displayed in the report itselves are written with comma as decimal separator. It is only the parameter that wants dot/point (.) as decimal separator.
    ThanksJohan

    Hi Sabcat,
    You can temporarily rename the first channel to create header rows above the channels and temporarily rename the last channel to create channel header rows, such as unit information, then rename the channels back to their original values after the CSV export.  It's low-tech, but it works, and uses the full efficiency of the CSV data export, which runs in C++ code.  I have attached an example VBScript below which does this programmatically.  You will need to edit the DataFileSave() line to include the extra XML from the other posts to get your custom delimiter and comma options.  I don't know of any way to affect the NoValue text.
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments
    Attachments:
    ASCII Export with CSV Headers.zip ‏60 KB

  • Explicit cast needed to convert java.* to to oracle.*

    Hello,
    I am trying to compile and run the following JSP but keep getting the "Incompatible type for = Explicit cast needed ..." error. The JSP and oracle procedure code are as follows:
    <%@ page language="java" import="java.sql.*" %>
    <%@ page import="oracle.jdbc.driver.*" %>
    <HTML>
    <HEAD>
    <TITLE>
    SimpleQuery JSP
    </TITLE>
    </HEAD>
    <BODY BGCOLOR=EOFFFO>
    <TABLE BORDER=1 BGCOLOR="C0C0C0">
    <TH BGCOLOR="white"> <I>Node ID</I> </TH>
    <%
         Connection con = null;
    OracleCallableStatement cstmt= null;
         ResultSet rs = null;
    try {
              String SYSTEM_DB_DRIVER =
    "oracle.jdbc.driver.OracleDriver";
    String SYSTEM_DB_URL =
    "jdbc:oracle:thin:@myserver.com:1521:";
    String SYSTEM_DB_FILE = "CONN_STRING";
    String SYSTEM_DB_USER = "UNAME";
    String SYSTEM_DB_PASSWORD = "PASSWD";
              Class.forName(SYSTEM_DB_DRIVER);
    con = DriverManager.getConnection(SYSTEM_DB_URL +
    SYSTEM_DB_FILE, SYSTEM_DB_USER, SYSTEM_DB_PASSWORD);
              cstmt = con.prepareCall("call eaicl_p_requirement.open_rule_dtl(?,?)");
              cstmt.registerOutParameter(1, OracleTypes.CURSOR);
    <<I think I have to pass the p_product_id_in here but not sure how>>
              cstmt.execute();
              rs = ((OracleCallableStatement)cstmt).getCursor(1);
              while(rs.next())
              {%>
         <TR>
         <TD ALIGN=CENTER> <%= rs.getString(1) %> </TD>
         <TD ALIGN=CENTER> <%= rs.getInt(2) %> </TD>
    </TR>
              <%}
                   rs.close();
    cstmt.close();
    con.close();
    catch(Exception e)
    %>
    </TABLE>
    </BODY>
    </HTML>
    The Oracle PL/SQL package.procedure it is calling is:
         PROCEDURE open_rules_dtl (
              prc_rules_dtl_out          OUT     rc_fetch_rule_dtl,
              p_product_id_in          IN          NUMBER )
         IS
              vrc_rules_dtl               rc_fetch_rule_dtl;
         BEGIN
              OPEN vrc_rules_dtl FOR
                   SELECT
                        r.rule_id,
                        r.rule_name,
                        r.rule_objective,
                        r.rule_description,
                        r.clearance_requirement,
                        r.rule_type
                   FROM
                        eaicl_rule r
                   WHERE
                        r.is_old = 'N' AND
                        r.product_id = CHR( p_product_id_in )
                   ORDER BY
                        r.rule_name
              prc_rules_dtl_out := vrc_rules_dtl;
    END open_rules_dtl;
    I keep getting the following error on the webserver:
    [05/Dec/2001:16:56:02] info ( 632): JSP: JSP1x compiler threw exception
    org.apache.jasper.JasperException: Unable to compile class for JSPC:\iPlanet\Server4\https-wacc\config\..\ClassCache\_jsps\_ss_test5_jsp.java:84: Incompatible type for =. Explicit cast needed to convert java.sql.CallableStatement to oracle.jdbc.driver.OracleCallableStatement.
              cstmt = con.prepareCall("call eaicl_p_requirement.open_rule_dtl(?,?)");
              ^
    I'm not sure how to fix it. I also need to pass the p_product_id parameter to the procedure.
    Hope someone can point me in the right direction. Thanks.

    Here's how you do an explicit cast:cstmt = (OracleCallableStatement)con.prepareCall("call eaicl_p_requirement.open_rule_dtl(?,?)");

  • Comma and Decimal point

    Hi Gurus,
    I am encountering a problem regarding printout of our SOA
    Instead of the standard format of the total value (comma then decimal point (ex. 2,559.62)) output is (decimal point then comma(ex. 2.559,62)). This always happens to a particular customer only. What should I do?
    Regards,
    Jay

    Hi,
    The decimal notation of numbers in Visual Composer is based on the Locale as set in the Portal
    (User Administration -> select user (or group) -> Language)
    if language is not set, it's based on IE language, and afterwards on the OS language.
    therefore, setting a number field formatting to "LOCALE_NUM" or checking the "Local Format" checkbox in the field's formatting tab, will cause the runtime to format the number according to the above.
    Your customer is probably currently on a non US locale.
    Best Regards,

  • Why is it such a pain to use java in a country that uses commas as decimal?

    Why is it such a pain to use java in a country that uses commas as decimal separator?
    A few weeks back I've asked here about the keypad decimal key. For some reason, java doesn't map the decimal key to a comma on the Portuguese (Portugal) keyboard layout. I've got no answer and I ended up using a custom plainDocument on the JTextFields to replace all points with commas.
    Now, I've just spent the whole morning trying to store and use decimal numbers properly. For some reason, a Double/Float .valueOf method (or the corresponding parse method) simply ignores the locale in use and uses US defaults when parsing the string. I can't parse anything with commas in those methods and I should, as it is the decimal separator for the system and default locale being used by java.
    First of all, I shouldn't be expected to perform replacements on every single operation that comes with a comma and I obviously can't be expected to program my own locale checking to decide what decimal separator to use in each final system. Second, is there any way to work with numbers seamlessly, without having to know the locale of the end user?
    I'm sorry if this is all my fault for doing something completly wrong, I'm new to java and I did search around to no avail. I'm really frustrated with what seems to be a complete lack of support in java for locales other than the US one.

    Good old Cobol has the "DECIMAL-POINT IS COMMA" clause... And isn't it great? :)
    Second, is there any way to work with numbers seamlessly, without having to know the locale of the end user?Consider "123.456". In some locales, this number is one hundred twenty-three thousand, four hundred fifty-six. In other locales it is one hundred twenty-three and four hundred fifty-size thousandths. How will you be able to determine which, without a locale?That's not what I've meant. Java should know the locale and behave accordingly. I don't have to know the locale of the end user since it might vary greatly. My point is that if strings are flying around with commas and if comma is the decimal separator on the end user's machine, any method aimed at parsing a numeric value out of a string should regard commas as such. I'm constantly replacing dots with commas and vice versa which could cause trouble if a different locale is used.
    And I mean that as a rant. Given my inexperience with Java, there might be good reasons for such a behaviour as baftos argued. What I'm really interested is in finding the proper way to deal with this issue.
    Have you tried the NumberFormat.parse? I will now.
    Edited by: Smigh on Apr 9, 2008 9:21 AM

  • I want to convert number to hours in oracle 10 like this.

    Dear All
    Some can help me
    I want to convert below MS-SQL query in oracle 10g. please help me.
    for eg:
    Select numasdate,
    Cast(numasdate / 60 as Varchar) + ' hours ' +
    Cast(numasdate % 60 as Varchar) + ' minutes'
    as [TotalHoursAndMinutes]
    From
    #SampleTable
    Output:
    9436 157 hours 16 minutes
    537 8 hours 57 minutes
    9323 155 hours 23 minutes
    12525 208 hours 45 minutes
    Edited by: Parwez on Jan 1, 2013 5:33 AM

    I want to convert number to hours in oracle 10g like this.
    537 8 hours 57 minutes
    9436 157 hours 16 minutes
    12525 208 hours 45 minutesTry this...
    Ranit>> with xx as(
      2      SELECT 537 num from dual UNION ALL
      3       SELECT 9436 num from dual UNION ALL
      4       SELECT 12525 num from dual
      5  )
      6  select
      7       num,
      8       FLOOR(num/60)||' hrs' as "hrs",
      9       MOD(num,60)||' minutes' as "minutes",
    10       FLOOR(num/60)||' hrs  '||MOD(num,60)||' minutes' as "Hours.Mins"
    11  from xx;
           NUM hrs                                          minutes                                          Hours.Mins                                                                                                        
           537 8 hrs                                        57 minutes                                       8 hrs  57 minutes                                                                                                 
          9436 157 hrs                                      16 minutes                                       157 hrs  16 minutes                                                                                               
         12525 208 hrs                                      45 minutes                                       208 hrs  45 minutes                                                                                                Edited by: ranit B on Jan 1, 2013 6:51 PM
    --- Hey John... I just did it and saw your hint now !!!

  • How to convert varchar to BLOB in oracle 10g?

    Hi all,
    I have 2 columns A and B which are of varchar2(2000) dataype.
    I would like to concatinate these 2 columns and convert them into BLOB in oracle 10g.
    Any help is appreciated.
    Regards,
    Ravi

    don't use BLOB to store large text, use CLOB instead
    anyway:
    SQL> create table test
      2  (txt varchar2(10)
      3  ,other varchar2(10)
      4  );
    Table created.
    SQL>
    SQL> insert into test values ('some text', 'other text');
    1 row created.
    SQL>
    SQL> create table test2
      2  (col blob)
      3  /
    Table created.
    SQL>
    SQL> insert into test2
      2  select utl_raw.cast_to_raw (txt||other)
      3    from test
      4  /
    1 row created.
    SQL> select *
      2    from test2
      3  /
    SP2-0678: Column or attribute type can not be displayed by SQL*Plus
    SQL>
    SQL> select utl_raw.cast_to_varchar2(col)
      2    from test2
      3  /
    UTL_RAW.CAST_TO_VARCHAR2(COL)
    some textother text
    SQL>
    SQL> drop table test
      2  /
    Table dropped.
    SQL> drop table test2
      2  /
    Table dropped.

  • How to convert HTTP to HTTPS in Oracle Application Server 10g(10.1.3)

    Can you please suggest notes to convert HTTP to HTTPS in Oracle Application Server 10g(10.1.3) as we need this to integrate the custom apps with EBS(12.1.3)?
    Appreciate your quick response,
    RM

    For Oracle EBS R12, the docs provided above should be helpful. If you want to configure the application server with SSL (assuming you have 10gAS installed), please refer to Oracle AS10g documentation -- Secure Sockets Layer (SSL)
    Oracle Application Server 10g Release 3 Documentation
    http://www.oracle.com/technetwork/middleware/ias/documentation/index.html
    Secure Sockets Layer (SSL)
    http://download.oracle.com/docs/cd/B25221_04/core.1013/b25209/part4.htm#BEHBDFGD
    Thanks,
    Hussein

  • To Convert Data From Access To Oracle

    Hi Allz,
    Is there any tool to convert mdb (microsoft data base) data to oracle 9i , because in oracle 8 there is Microsft Access Tool for Oracle, through that tool we can covert mdb data to oracle.How can we convert the same data in oracle 9i.
    Thanks

    You could use Oracles Migration Workbench
    http://www.oracle.com/technology/tech/migration/index.html

  • How can i convert data from DBF to oracle database 10g?

    Sir,
    How can i convert data from DBF to oracle database 10g?

    I assume you at least know how to dump the contents of foxpro dbf file into CSV format.
    Regarding SQL*Loader, hope this demo makes it a bit clear to you...
    http://www.princeton.edu/~storacle/sqlloader_demo.shtml
    I agree that it is an old web page (references Oracle 8.0.5) but basics remain the same.
    If it is still unclear to you after referring above link, then get an Oracle consultant.

  • Converting character to decimal format

    hi
    i am working on a development where the selection screen has date and time as select options.
    and based on the input i have to concatenate date and time into the format- DD.MM.YYY HH.MM.SS
    there is a value in the table that has a field containing the above value and i have to fetch the data based on this input.
    Now the problem is the field in the table is of format DECIMAL of 16 length.
    i want to know how can i pass this value to the select statement.
    thanks in advance

    Hi ,
    Please check the blog on the below link.
    [Re: Converting char to decimal value format as defined in SU3(User profile);
    This will solve your query.
    Regards
    Abhii......

  • How to convert string to decimal in data association function?

    In a BPM Script component, how in the Data Association can I use an expression to convert an argument from String to Decimal?  I have a Process argument named percentage which is a string.  I need to set the value of a data object called signed to either "Y" or "N" based on the percentage being greater than 0.4.  Something like this:
    (percentage > 0.4) ? "Y" : "N"
    The problem here is that percentage is a string, so must be converted to a decimal value before the compare will work.  I cannot find a function that allows that.  I need something like parseDecimal(percentage), but the Expression Builder does not offer that for a string using a Simple Expression.
    If it cannot be converted, is there another way to do this?

    Guessing you figured this out on your own, but if you wanted to use a Script activity one way to do what you want is when you're creating your data associations drag the "Expression" icon in the middle and double click the icon in the middle you just added:
    Get out of the Simple expression mode and into the XPath expression mode by clicking the dropdown in the upper left corner -> click "XPath Exp".
    In the Functions dropdown on the right, click "Conversion Functions" -> click "number" and then insert it into the expression.
    In the Variables list, select your string variable and insert it into the number function so that it looks something like this:  number(bpmn:getDataObject('myStringVariable'))
    Click OK
    Click your expression icon in the middle and drag it over your decimal variable.
    To have it evaluate and return a Boolean expression in your Script activity, add a Boolean process variable and add an XPath expression as described above except have the logic be this:  number(bpmn:getDataObject('myStringVariable')) > .4  (the "greater than" shown above is added to the expression by clicking "Logical Functions" from the functions dropdown).  Click OK and drag your expression icon over your Boolean variable.
    Dan

Maybe you are looking for