SQLLoader inserting trailing zeroes

Hi,
I have a .csv file with numeric data having no trailing zeroes after decimal point.
But when I import data from this .csv file into oracle using SQLLoader, the data is stored in the form having trailing zeroes after decimal point.
The datatype of column into which I am inserting this data is VARCHAR2.
Can anyone please provide some information regarding this?
Thanks in advance!
Avinash.
Pune - India.

Hello,
I am not sure at all that posting this kind of question in a Forms forum would increase your chances to get an answer. Did you try the database relative forums?
Francois

Similar Messages

  • How to get PL/SQL output in Excelsheet & preserve trailing zero for VARCHAR

    Hi All,
    I am trying to get the PL/SQL procedure out put to Excel sheet, I have wrote below code and it worked fine.
    CREATE OR REPLACE PROCEDURE plsql_to_excel_demo IS
    CURSOR cur_stock_details
    IS
    SELECT *
    FROM stocks;
    outfile UTL_FILE.file_type;
    l_chr_string VARCHAR2(100);
    l_chr_col_header VARCHAR2(100);
    l_chr_file VARCHAR2(100);
    l_chr_date VARCHAR2(20);
    BEGIN
    SELECT TO_CHAR(sysdate,'DD_MON_YYYY')
    INTO l_chr_date
    FROM dual;
    l_chr_col_header :='SYMBOL'||CHR(9)||'COMPANY'||CHR(9)||'CURRENT_PRICE'||CHR(9)||'TRADE_DATE'||CHR(9)||'NUMBER_TRADED_TODAY'
    ||CHR(9)||'TODAYS_HIGH'||CHR(9)||'TODAYS_LOW';
    l_chr_file := 'STOCK_REPORTS_'||l_chr_date||'.xls';
    outfile := UTL_FILE.FOPEN ('/u01/app/UTL/out',l_chr_file, 'W');
    UTL_FILE.PUT_LINE(outfile,l_chr_col_header);
    FOR rec_stock_details IN cur_stock_details LOOP
    /*l_chr_string := rec_stock_details.symbol||CHR(9)||''''||rec_stock_details.company||''''||CHR(9)
    ||rec_stock_details.current_price||CHR(9)||
    TO_CHAR(rec_stock_details.trade_date,'DD/MM/YYYY')||CHR(9)||rec_stock_details.number_traded_today||CHR(9)||
    rec_stock_details.todays_high||CHR(9)||rec_stock_details.todays_low;
    l_chr_string := rec_stock_details.symbol||CHR(9)||rec_stock_details.company||CHR(9)||rec_stock_details.current_price||CHR(9)||
    TO_CHAR(rec_stock_details.trade_date,'DD/MM/YYYY')||CHR(9)||rec_stock_details.number_traded_today||CHR(9)||
    rec_stock_details.todays_high||CHR(9)||rec_stock_details.todays_low;
    UTL_FILE.PUT_LINE(outfile,l_chr_string);
    END LOOP;
    UTL_FILE.FCLOSE (outfile);
    EXCEPTION
    WHEN OTHERS THEN
    dbms_output.put_line ('Error in main '||SQLERRM);
    END plsql_to_excel_demo;
    I am facing the issue when I have VARCHAR2 column say Company in stocks table with value as 0000234. When I get the data Excel
    sheet I can only see 234
    for company name. I want to preserve the trailing zeros while getting the output in Excel sheet.
    I have tried with adding single quote (') please see the commented part in the above code, but it will give me output in company
    column in excel '0000234' which i don't want.
    Is there any way I can make this work and only get 0000234 as company name in Excel.
    Thanks for reading the post..
    regards,
    Shyam.
    Edited by: Suryawanshi on Mar 22, 2010 5:40 PM

    Yes, that should be a client (excel, or open office in my case) issue.
    I stole some code from http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:95212348059 to test this out.
    Adding a single quote to the beginning of the string worked fine with my version of Open Office, should work for your Excel as well.
    create table varchar2_test(col1 varchar2(10), col2 number(10));
    insert into varchar2_test values ('000189', 10);
    create or replace function  dump_csv( p_query     in varchar2,
                                          p_separator in varchar2 default ',',
                                          p_dir       in varchar2 ,
                                          p_filename  in varchar2 )
    return number
    is
        l_output        utl_file.file_type;
        l_theCursor     integer default dbms_sql.open_cursor;
        l_columnValue   varchar2(2000);
        l_status        integer;
        l_colCnt        number default 0;
        l_separator     varchar2(10) default '';
        l_cnt           number default 0;
    begin
        l_output := utl_file.fopen( p_dir, p_filename, 'w' );
        dbms_sql.parse(  l_theCursor,  p_query, dbms_sql.native );
        for i in 1 .. 255 loop
            begin
                dbms_sql.define_column( l_theCursor, i, l_columnValue, 2000 );
                l_colCnt := i;
            exception
                when others then
                    if ( sqlcode = -1007 ) then exit;
                    else
                        raise;
                    end if;
            end;
        end loop;
        dbms_sql.define_column( l_theCursor, 1, l_columnValue, 2000 );
        l_status := dbms_sql.execute(l_theCursor);
        loop
            exit when ( dbms_sql.fetch_rows(l_theCursor) <= 0 );
            l_separator := '';
            for i in 1 .. l_colCnt loop
                dbms_sql.column_value( l_theCursor, i, l_columnValue );
                utl_file.put( l_output, l_separator || l_columnValue );
                l_separator := p_separator;
            end loop;
            utl_file.new_line( l_output );
            l_cnt := l_cnt+1;
        end loop;
        dbms_sql.close_cursor(l_theCursor);
        utl_file.fclose( l_output );
        return l_cnt;
    end dump_csv;
    variable x number;
    begin
       :x :=    dump_csv
                   p_query     => 'select '''' || col1, col2 from varchar2_test',
                   p_separator => ',',
                   p_dir       => 'TEST_DIR',
                   p_filename  => 'test_output.xls'
    end;
    print :x

  • Retain trailing zero's after decimal

    Hi,
    i have a requirement to retain trailing zero's after decimal....
    is it possible?
    version: 9.2.0.7
    example: select 150.200 from dual;
    we will get 150.2 as output.
    but i need 150.200 as the output...
    how would i do this?

    oraDBA2 wrote:
    Hi tony,
    sorry, that is not the constant value...that is a variable based on the value, what user enters with the decimals.......if i understood you correctly,
    it seems like you will need to use char or varchar2 datatypes in that table to start doing what you would like to do in the way you wan't it.
    and still you have option to apply to_number and to_char on that varchar2 column.
    SQL> create table b (charr varchar2(15) );
    Table created.
    SQL>
    SQL>
    SQL> insert into b (charr) values ('1000.000');
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select* from b;
    CHARR
    1000.000
    http://stanford.edu/dept/itss/docs/oracle/10g/appdev.101/b10795/adfns_ty.htm#1006325

  • How to delete trailing zeros from a quantity field to display in ALV?

    Hi there,
    i am retrieving the field LGMNG from LIPS table, which is of type QUAN(13). All LGMNG values there are stored as
    1,000
    20,000
    50,000 etc.
    But i want my values to be displayed as
    1
    20
    50 etc.
    i have tried the " shift v_variable right deleting trailing '0'" but it does not work.
    also, if the value of LIPS_LGMNG =  0,000, i need those columns in ALV empty(that is no zeros or comma displayed)
    can anyone please help?
    Thanks a lot,
    Mee

    hi,
    use this it will solve your problem, just write down this on your Fieldcatalog.
       WA_FIELDCATALOG-FIELDNAME = 'VALUE7'.
       WA_FIELDCATALOG-SELTEXT_L = 'Contribution EE(due)'.
      WA_FIELDCATALOG-DATATYPE = 'INT2'.           " it will remove trailing zero
      WA_FIELDCATALOG-DECIMALS_OUT = 0.
       APPEND WA_FIELDCATALOG TO IT_FIELDCATALOG.
       CLEAR WA_FIELDCATALOG.

  • I want to remove Trailing zeros from a charecter value

    Hello ,
              i want to remove trailing zeros for a prticular value.Following is my code :
    DATA: V_FLOAT TYPE F VALUE '4.8240000000000000E+03',
               V_CHAR(25) ,
               P10_4(10) TYPE P DECIMALS 4.
    CALL FUNCTION 'CEVA_CONVERT_FLOAT_TO_CHAR'
    EXPORTING
    FLOAT_IMP = V_FLOAT
    FORMAT_IMP = P10_4
    ROUND_IMP = ' '
    IMPORTING
    CHAR_EXP = V_CHAR.
    SHIFT V_CHAR RIGHT DELETING TRAILING '0'.
    WRITE : V_CHAR ."NO-ZERO.
    <u><b>Output:</b></u>
    if we pass the value '1.3000000000000000E+01' it should be 13.0
    ex2: '1.3400000000000000E+01' it should be 13.4
    ex3:'4.8240000000000000E+03' it should be 4824
    is there any way to get the solution without functional module. If so Please tell me with code.

    hi
    u can do it in number of ways.
    Use TCODE SU3
    Select default tab and select radio button 123467.89 in decimal notation and save it.
    or u can try :
    if you want to do this through ABAP program.
    1. to delete trailing spaces.
    SHIFT <V_VARIABLE> RIGHT DELETING TRAILING '0'.
    to delete leading zeroes,
    SHIFT <VARIABLE_NAME> LEFT DELETING LEADING '0'.
    only for one abap program, u can use set country command
    for all programs :
    sap menu>system->go to user profil->own data>default --> and choose ur format.
    hope this helps u.
    Regards,
    Prasanth
    Reward all hepful replies

  • How to ensure File Read Adapter handles like SQLLOADER's TRAILING NULLCOLS

    I have to read a CSV file which has a specific format but sometimes the trailing columns values can be missing and i would like to handle it in such way that they values are treated as null. This is similar to the SQLLoader's TRAILING NULLCOLS clause.
    Currently if my data is as shown below:
    As-Of Date,As-Of-Time,Bank ID,Bank Name,State,Acct No,Acct Type,Acct Name,Currency,BAI Type Code,Tran Desc,Debit Amt,Credit Amt,0 Day Flt Amt,1 Day Flt Amt,2+ Day Flt Amt,Customer Ref No,Value Date,Location,Bank Reference,Tran Status,Descriptive Text,Descriptive Text1,Descriptive Text2,Descriptive Text3,Descriptive Text4,Descriptive Text5,Descriptive Text6
    20061031,23:59:00,121000248,"WELLS FARGO BANK, N.A.",CA,4121235097,COMMERCIAL DDA,Silicon Image - A/P,USD,475,CHECK PAID,55.86,0,0,0,0,51689,10/31/2006,,IA000313659233,POSTED,,,,,,,
    20061031,23:59:00,121000248,"WELLS FARGO BANK, N.A.",CA,4121235097,COMMERCIAL DDA,Silicon Image - A/P,USD,475,CHECK PAID,1377.57,0,0,0,0,51685,10/31/2006,,IA000210166161,POSTED
    20061031,23:59:00,121000248,"WELLS FARGO BANK, N.A.",CA,4121235097,COMMERCIAL DDA,Silicon Image - A/P,USD,475,CHECK PAID,1435,0,0,0,0,51621,10/31/2006,,IA000627084628,POSTED
    It reads the first row properly , but when in encounters the second row POSTED column , it tries to find the terminated column and since it is not present it reads data from the next line until it finds a comma.
    This is not the way i would like to handle it.
    We get around 1000-2000 records in that CSV from the Bank and they cant change the way they are sending the file. So , please help in resolving this issue.
    Thanks
    Sridhar

    Hi thanks for the reply
    well i've been having a play around but haven't got it to work yet,
    Here's what i have so far
    private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {
             BufferedReader  sb = new BufferedReader();
           sb.append(""+jTextField1.setText()+",");
           sb.append(""+jFormattedTextField1.setText()+"\n");
           sb.append(""+jTextField2.setText()+",");
           sb.append(""+jFormattedTextField2.setText()+"\n");
           sb.append(""+jTextField3.setText()+",");
           sb.append(""+jFormattedTextField3.setText()+"\n");
           sb.append(""+jTextField4.setText()+",");
           sb.append(""+jFormattedTextField4.setText()+"\n");
           sb.append(""+jTextField5.setText()+",");
           sb.append(""+jFormattedTextField5.setText()+"\n");
           ReadFromFile(sb.toString());
        private void ReadFromFile(String s) {
            try {
            BufferedReader in = new BufferedReader(new FileReader("/users/data.txt"));
            String str;
            while ((str = in.readLine()) != null) {
                Process(str);
            in.close();
        } catch (IOException e) {
        }// TODO add your handling code here:
                    }im thinking the problem is the parts that say sb.append but i don't know what to in it's place?

  • How can i retain the trailing zeroes after decimal

    how can i retain the trailling zeros after decimal?
    values are showing in table like( 4.50,5.00) but i am trying to do some processing with these values then ithe zeroes are truncated like (4.5,5),
    how can i get values with zeroes

    If the values in the table have trailing zeroes, it's a character type column.
    Once you perform operations on them, they're implicitely converted to the number type, hence "losing" trailing zeroes.
    To get the trailing zeroes back, you have to convert them back to character data:
    TO_CHAR(1.5*3, '90d99')Have fun,
    K.

  • Remove trailing zeroes in quantity field.

    Hi all,
    I am having quantity field in ALV grid display : VBAP-KWMENG. Iam getting quantity value as 1,000.My requirement is to get quantity value as 1.(without ',' and zeroes).
    Suggest me a suitable solution.
    Thanks all.

    Other way is check for the below code ..
    DATA:
      lv_decimal TYPE f DECIMALS 3,
      lv_string  TYPE string.
    lv_decimal = '22.010'.
    WRITE lv_decimal TO lv_string.
    SHIFT lv_string RIGHT DELETING TRAILING '0'.
    * also delete trailing '.', if possible
    SHIFT lv_string RIGHT DELETING TRAILING'.'.
    CONDENSE lv_string NO-GAPS.
    * now no trailing zeros are in the decimal stored in LV_STRING

  • Answers report-download as Excel loose trailing zeroes

    Hi!
    When I download Answers report to Excle (Word) I loose trailing zeroes.
    1.2500 -> 1.25Trailing zeroes are important and I'd like that format remain as it is in OBI in all downloading types (Excel, Word etc).
    When I export to PDF (run through Oracle BI publisher) trailing zeroes are correct.
    Any help please.
    My config, OBI on Windows 2003 32 bit:
    Product Information
    Oracle Business Intelligence Product Version     10.1.3.4 (Build 080726.1900)
    Physical Presentation Catalog Path     \\?\C:\OracleBIData\web\catalog\teb\root
    Oracle BI Server Data Source     AnalyticsWeb
    Available Paging Memory (MB)     5176
    Available Virtual Address Space (MB)     1833

    Hi,
    here are mine data as requested ...
    The only three formating columns are Cash up KN, Cash up EUR i Cash up EUR/KN.
    Column that has problem has no "mso" like formating at all, only two decimal number format, defined in classic way in OBI.
    Generated Excel file from OBI:http://sites.google.com/site/vadasovi/icon_holders-1/BAZA.xls
    How it is opened in Excel 2003:http://sites.google.com/site/vadasovi/_/rsrc/1318338523563/Home/temp/2007.PNG , look column in red.
    Same file in Excel 2010 (other mashine then 2003:http://sites.google.com/site/vadasovi/_/rsrc/1318338543353/Home/temp/2010.png
    Both client are Win XP SP3 with Croatian locale (same one in detail).
    Rg,
    Damir

  • Add Trailing  zeros to a number or char

    Hi Experts,
               my material number is stored in the form of Character so i want to add a trailing zero to that number
               supposr for example my material number is ccf5a   so i want add zeroes to make it 18  like   cf5a0000000000000 characters
              Please help me on this  hoping for the quick replay.

    Use [CONCATENATE|http://help.sap.com/abapdocu/en/ABAPCONCATENATE.htm] (only once with a constant initialized with 18 zeroes)
    or
    go to [PAD|http://help.sap.com/abapdocu/en/ABAPCOMPUTE_STRING_FORMAT_OPTIONS.htm#!ABAP_ADDITION_3@3@] in [Embedded expressions format_options |http://help.sap.com/abapdocu/en/ABAPCOMPUTE_STRING_FORMAT_OPTIONS.htm] in [String Templates - embedded_expressions|http://help.sap.com/abapdocu/en/ABENSTRING_TEMPLATES_EXPRESSIONS.htm] in [string_exp - String Templates |http://help.sap.com/abapdocu/en/ABENSTRING_TEMPLATES.htm] in [string_exp - String Expressions|http://help.sap.com/abapdocu/en/ABAPCOMPUTE_STRING.htm] in [Expressions and Functions for String Processing |http://help.sap.com/abapdocu/en/ABENSTRING_PROCESSING_EXPR_FUNC.htm]
    Regards,
    Raymon

  • How to delete Trailing zeros in a string array

    I am reading data from RS232 port and storing the values in an array of 16 nos. Then converting the array of numbers into string using 'number to fractional string" function with precession 2  and sending the data string to Table. I am printing this table further for report generation.
    I am unable to remove the trailing zeros as i am defining precession 2 which is not needed for all the numbers in the table.
    Please help me how to remove the trailing zeros after decimal point which is very much necessary for report generation.
    regards
    Prasanna Kumar N M

    Use format into string in a FOR loop with a format specified of %#f. See attached example (LabVIEW 7.0)
    Message Edited by altenbach on 10-14-2006 05:40 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    AutoFormat.vi ‏17 KB
    AutoFormat.png ‏3 KB

  • How to delete trailing zeros after decimal ?

    Hi,
    i want to delete trailing zeros after decimal.
    Example:
    if it is 22.000 then output will be 22
    if it is 22.010 then output will be 22.01.
    plz let me know hw to do this ?

    DATA:
      lv_decimal TYPE f DECIMALS 3,
      lv_string  TYPE string.
    lv_decimal = '22.010'.
    WRITE lv_decimal TO lv_string.
    SHIFT lv_string RIGHT DELETING TRAILING '0'.
    CONDENSE lv_string NO-GAPS.
    * now no trailing zeros are in the decimal stored in LV_STRING
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Jan 30, 2008 12:10 PM

  • Export to excel truncates trailing zeros

    When we try to export to excel trailing zeros are truncated like this:
    In report on BIEE dashboar:
    Product----Amount
    Product A 327,876
    Product B 4,000
    Product C 1,278
    In the exported excel spreadsheet:
    Product A 327,876
    Product B 4
    Product C 1,278
    Any ideas for a solution?

    well it is because excel thinks the the comma is a decimal seperator in stead of a thousands seperator.
    So check your operating system properties and your excel properties.

  • IHow to force display of trailing zeros for fixed point numbers?

    I have an 8 bit unsigned fixed point number, with 7 integer bits and 1 fractional bit, so the desired delta is 0.5. I want it to always display the fractional bit, even when that bit is 0. In other words, as this number is incremented, I want to see:
    0.0
    0.5
    1.0
    1.5
    etc.
    But instead I'm seeing:
    0
    0.5
    1
    1.5
    etc.
    I set the display format to Floating point, with 1 digit of precision. The "Hide trailing zeros" checkbox is NOT checked. What am I doing wrong?
    I realize I could convert to single precision for display purposes to make this happen, but I'd rather make this work with fixed point.
    Thanks,
    -Ron

    I just rustled up a VI with what I understand your input to be - unsigned 7 bit mantissa and 1 bit exponent input, and have it displaying 2 decimal places.... Is this what you're after or did I miss it?
    - Cheers, Ed
    Attachments:
    zeros.vi ‏7 KB

  • Simple transformation dropping trailing zero.

    Hi experts.
    I am having a problem with my transformation file, and I was hoping someone could help me.
    I have created a simple transformation file, with a variable using the type of "DMBTR" which Does have 2 decimal points.
    IF I have data - the two decimal points print.
    EG if the amount is 100.57..    I get the 100.57 to print which is what I need and expect.
    BUT.
    IF the amount is 100.50    I am getting 100.5    Is is dropping the final zero amount, and therefore is failing in the validation.
    HOW can I FORCE the two decimal points to print?
    I have even tried it where I declare it as a variable of type "I" with 2 decimal points, and it still does not work.
    I can not figure out how to use the Number format   option with a Value-ref print line.
    If someone could help me with that.. I could try that to see if it worked.
    thank you.
    eg: of the way the data is declared:
      <tt:type name="GRTOT14" type="I" length="13" decimals="2"/>
    OR
      <tt:type name="GRTOT16" type="ddic:DMBTR"/>
      <tt:type name="GRTOT17" type="ddic:DMBTR"/>
    eg: of the way I am using it where I am getting only one decimal place if the 2nd decimal place is ZERO
                 <tot_grnt_sbsdy_amt tt:value-ref=".GRTOT14"/>
                   <tot_insu_prcd_amt tt:value-ref=".GRTOT16"/>
                  <tot_opay_rcap_amt tt:value-ref=".GRTOT17"/>
    PLEASE HELP.
    thank you.

    From what I understand about XML (could be more), the canonical representation of decimal values does not allow a fixed number of decimal places.
    SAP documentation:
    http://help.sap.com/saphelp_nw04/helpdata/en/52/491a40251e2402e10000000a1550b0/frameset.htm
    from there, this XML documentation is referenced:
    http://www.w3.org/TR/xmlschema-2/#decimal
    important bit:
    Leading and trailing zeroes are prohibited subject to the following: there must be at least one digit to the right and to the left of the decimal point which may be a zero.
    You already discarded my workaround: using a character or string type field and fill it to your liking prior to serialisation.
    Thomas

Maybe you are looking for

  • HttpURLConnection and the killer Pound (#)

    I'm trying to create a part of my application that posts data to an ASP page (on an affiliate's web site). Originally, I was using the following code to post the data: URL url = new URL(sPostURL);                     HttpURLConnection conn = (HttpURL

  • BADI for MIGO problem

    Hello everybody! I found badi of MIGO.   -> "MB_MIGO_BADI". but this within exit have a method, namely PBO_DETAIL. when use this method i found have a problem!  as follows! DATA: GF_CLASS_ID TYPE MIGO_CLASS_ID. GF_CLASS_ID = 'MIGO_BADI_IMPLEMENTATION

  • How to convert ResultSet's value to String

    Dear JDC's plz tell me how to convert ResultSet's value to String. kashif

  • My library freezes halfway through loading

    I updated Itunes software to most current version 7.3.1 and now my library freezes halfway through loading. I've powered down and restarted and was able to backup library with the finder to an external hard drive (I think?). I've tried downloading th

  • Standard HRFORMS customization

    Hi All, SAVE ME !!!!! I have a requirement wherein I have to pull data from a custom Infotype to a standard SAP HRFORM. say for example :  I have a standard HRforms for US Payslip i.e. SAP_PAYSLIP_US. Now I want to pull data into this standard paysli