SQL*Loader how to handle decimal place

Hi all
I need to load data into table with number field (12,2)
however, the source data is 1,025.02. Then the data cannot be loaded and in log, there is error message Invalid Number
Please kindly advise how to handle this in control file?
Thanks
Thomas

load data
,YOUR_NUMBER_COLUMN .... ... ... " to_number(:YOUR_NUMBER_COLUMN,'999G999D99' , 'NLS_NUMERIC_CHARACTERS=''.,'' ')"
)

Similar Messages

  • How to maintain decimal places in BOM Qty & what is the essence of base qty

    Hello PP members
    How to maintain decimal places in BOM Qty & what is the essence of base quantity in BOM ?
    Thank You

    ur first question is not understood, You can have maximum of 3 decimals in BOM item qty.
    Base qty is the qty which is refered to all the BOM items.
    example -
    Product X, base qty 1
    Raw material 1 - componen t qty= 1
    Raw material 2 - Component qty= 5
    This means To produce Product with qty1, it needs raw material 1 qty 1  and raw material 2 qty 5.
    This means To produce Product with qty10, it needs raw material 1 qty 10  and raw material 2 qty 50.
    This is the meaning of Base qty..it is the referece qty refered to all the components.
    About the decimal places
    let us say  example 2
    To produce Product with qty1, it needs raw material 1 qty 1  and raw material 2 qty .0001.
    When you enter this in SAP for the raw materialm 2 system will give error message that you  need to enter the qty with maximum 3 decimal places, hence you need to enter as below
    Product with qty10, it needs raw material 1 qty 10  and raw material 2 qty .001.
    This is how you need to adjsut the base qty and component qty with decimalplaces moer than 3,
    pl come back

  • Sql Function to return 2 decimal places

    Hi,
    Can you please tell me how can i convert any integers to 2 decimal places using sql.
    for e.g 124 to 124.00
    150.2698 to 150.27
    12.3 to 12.30
    Thanks,
    Parvez

    Like this:
    SQL> with t as
      select 124 n from dual union all
      select 150.2698 from dual union all
      select 12.3 from dual
    select n, to_char(n,'9999.00') n_new from t
             N N_NEW  
           124   124.00
      150.2698   150.27
          12.3    12.30
    3 rows selected.?

  • SQL*Loader - How to combine 2 controlfiles to one controlfile

    I have several controllfiles which each import another table from another datafile, because I don't want execute every seperat or create a batch file.... I'm looking for a way to put they all in one single controlfile.
    example:
    1st ctl-file:
    LOAD DATA
    INFILE "t1.dat"
    INTO TABLE t1 REPLACE
    FIELDS TERMINATED BY "     "
    (c1,
    c2 "to_number(:c2,'99999999999999999.99999999999999999','NLS_NUMERIC_CHARACTERS=''.,''')",
    c3 date 'YYYY-MM-DD"T"HH24:MI:SS')
    gQuqT     478.60636734965914     2006-12-05T11:00:49
    ÜgQK     963.0277916962095     2006-12-30T08:03:00
    üZfxN     465.15226622488257     2006-12-30T09:14:12
    2nd ctl-file:
    LOAD DATA
    INFILE "t2.dat"
    INTO TABLE t2 REPLACE
    FIELDS TERMINATED BY "     "
    (c1,
    c2 "to_number(:c2,'99999999999999999.99999999999999999','NLS_NUMERIC_CHARACTERS=''.,''')")
    alvwxs     13.0
    poeh     15.0
    zpgiht     21.0
    At the examples is everytime used a id column, to ident which row should import in which table.
    But at my case i need something like a where condition from which file the data should be imported....how should it look?
    Can someone give me an advice how a controlfile should look which import both tables in one controlfile?
    BR
    roland

    It is not possible to combine the last 3 columns as those columns are seperated by commas and in the SQL Loader control file you must ve specified COMMA as an delimiter. So u better have all the columns in the table plus add one more column which holds the concatenation of the 3 columns.
    Vijay

  • SQL Loader (how to cut data header)

    Hi there,
    [oracle 11g]
    I got the following text file:
    mod; DD.MM.YYYY; HH:MM:SS; aligned
    src; "ptv "; "15.04.2012"; "10:47:49"
    chs; "ISO8859-1"
    ver; "V1.0"
    ifv; "V1.0"
    dve; "V1.0"
    fft; "LIO"
    tbl; MENGE_FGR
    atr; BASIS_VERSION; FGR_NR; FGR_TEXT
    frm; num[9.0]; num[5.0]; char[40]
    rec;        122;     8; "VVZ"   
    rec;        123;     18; "VHZ"
    rec;        124;     13; "VTZ"    Now I am interested in the column TBL and ATR and follwing rawdata
    Do you see a way to automatically create the table MENGE_FR with columns BASIS_VERSION; FGR_NR;FGR_TEST and column types num, num, char and insert the raw data below?
    PS:OK, this is mysql ...so I need to convert this first to sql. So you should see num as number.
    Thx in advance Thorsten
    Edited by: Thorsten on 16.05.2013 07:30
    Edited by: Thorsten on 16.05.2013 07:32

    There are various ways that you could do this. I have demonstrated one method below. I created a table with two columns, then used SQL*Loader to load the data from the text file into those two columns. Skipping the header rows is optional. You could also use an external table instead, if the text file is on your server, not your client. I then used some PL/SQL to create and execute "create table" and "insert" statements. This is just some starter code. You will need to make modifications to handle other data types and such that were not in the example that you provided, but it should give you the general idea.
    SCOTT@orcl_11gR2> host type text_file.dat
    mod; DD.MM.YYYY; HH:MM:SS; aligned
    src; "ptv "; "15.04.2012"; "10:47:49"
    chs; "ISO8859-1"
    ver; "V1.0"
    ifv; "V1.0"
    dve; "V1.0"
    fft; "LIO"
    tbl; MENGE_FGR
    atr; BASIS_VERSION; FGR_NR; FGR_TEXT
    frm; num[9.0]; num[5.0]; char[40]
    rec;        122;     8; "VVZ"
    rec;        123;     18; "VHZ"
    rec;        124;     13; "VTZ"
    SCOTT@orcl_11gR2> host type test.ctl
    options(skip=7)
    load data
    infile text_file.dat
    into table tbl
    (col1 terminated by ';',
    col2 terminated by x'0a')
    SCOTT@orcl_11gR2> create table tbl
      2    (col1  varchar2(4),
      3     col2  varchar2(60))
      4  /
    Table created.
    SCOTT@orcl_11gR2> host sqlldr scott/tiger control=test.ctl log=test.log
    SQL*Loader: Release 11.2.0.1.0 - Production on Thu May 16 13:44:24 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Commit point reached - logical record count 6
    SCOTT@orcl_11gR2> select * from tbl
      2  /
    COL1 COL2
    tbl   MENGE_FGR
    atr   BASIS_VERSION; FGR_NR; FGR_TEXT
    frm   num[9.0]; num[5.0]; char[40]
    rec          122;     8; "VVZ"
    rec          123;     18; "VHZ"
    rec          124;     13; "VTZ"
    6 rows selected.
    SCOTT@orcl_11gR2> declare
      2    v_tab   varchar2(30);
      3    v_atr   varchar2(32767);
      4    v_frm   varchar2(32767);
      5    v_sql   varchar2(32767);
      6    v_cols  number;
      7    v_next  varchar2(32767);
      8  begin
      9    select col2 into v_tab from tbl where col1 = 'tbl';
    10    select col2 || ';' into v_atr from tbl where col1 = 'atr';
    11    select col2 || ';' into v_frm from tbl where col1 = 'frm';
    12    v_sql := 'CREATE TABLE ' || v_tab || ' (';
    13    select regexp_count (col2, ';') + 1 into v_cols from tbl where col1 = 'atr';
    14    for i in 1 .. v_cols loop
    15      v_sql := v_sql || substr (v_atr, 1, instr (v_atr, ';') - 1) || ' ';
    16      v_next := substr (v_frm, 1, instr (v_frm, ';') - 1);
    17      v_next := replace (v_next, '[', '(');
    18      v_next := replace (v_next, ']', ')');
    19      v_next := replace (v_next, '.', ',');
    20      v_next := replace (v_next, 'num', 'number');
    21      v_next := replace (v_next, 'char', 'varchar2');
    22      v_sql := v_sql || v_next || ',';
    23      v_atr := substr (v_atr, instr (v_atr, ';') + 1);
    24      v_frm := substr (v_frm, instr (v_frm, ';') + 1);
    25    end loop;
    26    v_sql := rtrim (v_sql, ',') || ')';
    27    dbms_output.put_line (v_sql);
    28    execute immediate v_sql;
    29    for r in (select col2 from tbl where col1 = 'rec') loop
    30      v_sql := 'INSERT INTO ' || v_tab || ' VALUES (''';
    31      v_sql := v_sql || replace (replace (r.col2, ';', ''','''), '"', '');
    32      v_sql := v_sql || ''')';
    33      dbms_output.put_line (v_sql);
    34      execute immediate v_sql;
    35    end loop;
    36  end;
    37  /
    CREATE TABLE  MENGE_FGR ( BASIS_VERSION  number(9,0), FGR_NR  number(5,0),
    FGR_TEXT  varchar2(40))
    INSERT INTO  MENGE_FGR VALUES ('        122','     8',' VVZ')
    INSERT INTO  MENGE_FGR VALUES ('        123','     18',' VHZ')
    INSERT INTO  MENGE_FGR VALUES ('        124','     13',' VTZ')
    PL/SQL procedure successfully completed.
    SCOTT@orcl_11gR2> describe menge_fgr
    Name                                      Null?    Type
    BASIS_VERSION                                      NUMBER(9)
    FGR_NR                                             NUMBER(5)
    FGR_TEXT                                           VARCHAR2(40)
    SCOTT@orcl_11gR2> select * from menge_fgr
      2  /
    BASIS_VERSION     FGR_NR FGR_TEXT
              122          8  VVZ
              123         18  VHZ
              124         13  VTZ
    3 rows selected.

  • SQL*Loader: How to load multi-line report data?

    Hi,
    is it possible to use SQL*Loader to load data from a hierarchical structured fixed column ASCII file like this
    001 scott
    New York 01.01.2002 1234
    Chicago 15.10.2001 9876
    002 smith
    Los Angeles 24.12.1999 5678
    Washington 01.12.1999 0000
    Chicago 01.01.2000 1111
    into one database table:
    id name city day code
    001 scott New York 01.01.2002 1234
    001 scott Chicago 15.10.2001 9876
    002 smith Los Angeles 24.12.1999 5678
    002 smith Washington 01.12.1999 0000
    002 smith Chicago 01.01.2000 1111
    The number of lines per name is unlimited, the next line starts after a separating ---- line.
    We cannot change the format of the text file to import.
    There is an example in the documentation that shows how to load a structure like the following via insert triggers:
    001 scott New York 01.01.2002 1234
    Chicago 15.10.2001 9876
    002 smith Los Angeles 24.12.1999 5678
    Washington 01.12.1999 0000
    Chicago 01.01.2000 1111
    But we have the name information on a separate header line, so I don't know if we can use a similar technique here.
    regards
    Sven

    Try enclosing your strings with e.g. a double-quote. To do so, the control file needs the following (example):
    LOAD DATA
    REPLACE
    INTO TABLE test          
    FIELDS TERMINATED BY '|' OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    id1,
    id2,
    id3,
    id4,
    )of course this does mean that your data must change...
    L.

  • SQL*LOADER how to load blanks when data is null

    I need to load data which contains null values into a table which cannot contains nulls. How can I tell SQL*LOADER to load blanks in a column when the input data is nulls?

    I think something like this in your control file should work:
    col1 char(10) nvl(col1,' ')

  • SQL*Loader - How to load only a few columns from a .csv file to ora table

    Hi there,
    Could anyone please let me know how to load few columns from a .csv
    file into a oracle table using SQL*Loader.
    I know how to create a .dat and .ctl file and run the sql loader.
    Suppose I have a .csv file with
    col1, col2, col3, col4
    and I only need to load col1 and col3 into col_a and col_b respectively
    in table_a?
    structure of table_ a
    col_a,
    col_b
    Please advice

    Try like..it i will work..
    LOAD DATA
    INFILE 'test.txt'
    LOAD DATA
    TRUNCATE INTO TABLE T1
    FIELDS TERMINATED BY ','
    (col1,
    col2 FILLER,
    col3,
    col4 FILLER
    )

  • Sql loader, how to get decimals into the database?

    oracle 10.2
    we have data of the form
    1.10
    1.11
    we are using "decimal external" in the control file.
    The table is a straight number field
    I did a test where I created a table with a number field and without and precision and did regular inserts. I got the decimal values.
    so I did
    create table x (y number);
    insert into x values (1.10);
    insert into x values (1.11);
    and i got back
    1.1
    1.11
    when we sql load we get
    1
    1

    Why use decimal external then? What's wrong with leaving the field as number?

  • SQL Loader-How to insert -ve & date values from flat text file into coloumn

    Question: How to insert -ve & date values from flat text file into coloumns in a table.
    Explanation: In the text file, the negative values are like -10201.30 or 15317.10- and the date values are as DDMMYYYY (like 10052001 for 10th May, 2002).
    How to load such values in columns of database using SQL Loader?
    Please guide.

    Question: How to insert -ve & date values from flat text file into coloumns in a table.
    Explanation: In the text file, the negative values are like -10201.30 or 15317.10- and the date values are as DDMMYYYY (like 10052001 for 10th May, 2002).
    How to load such values in columns of database using SQL Loader?
    Please guide. Try something like
    someDate    DATE 'DDMMYYYY'
    someNumber1      "TO_NUMBER ('s99999999.00')"
    someNumber2      "TO_NUMBER ('99999999.00s')"Good luck,
    Eric Kamradt

  • Sql loader how import a file with save the actual row number in a db field

    Hey,
    how can i save the row number for each row in a file into a database field i the same table with the sql loader (sqlldr)?
    test data:
    john doe
    joe meier
    table:
    name surname line_number_in_file
    john doe 1
    joe meier 2
    and so on ... an if an line is discarded because it is empty for example it should be as this:
    test data:
    john doe
    joe meier
    table:
    name surname line_number_in_file
    john doe 1
    joe meier 3
    thanks for helpinmg and excuse my very bad english :-)
    Message was edited by:
    user527827

    but if one of the when clause faild or some rows are
    rejectet the sequence is not right.Did you read the link?
    "If a record is rejected (that is, it has a format error or causes an Oracle error), the generated sequence numbers are not reshuffled to mask this. If four rows are assigned sequence numbers 10, 12, 14, and 16 in a particular column, and the row with 12 is rejected, the three rows inserted are numbered 10, 14, and 16, not 10, 12, and 14. This allows the sequence of inserts to be preserved despite data errors. When you correct the rejected data and reinsert it, you can manually set the columns to agree with the sequence."
    also if you read multiple lines and they inserted in
    the wrong order the number from the sequence is not
    the line number...what do you mean with "reading multiple lines and wrong order?"

  • How to decrease decimal places in invoices

    Good day,
    How do i drecrease decimal places in invoices. For example , i have set the decimal places to 4 for costing purposes but i want the final invoice to be 2 decimal places for display purposes. i have tried decreasing the decimals using the decrease decimals icon but the decimals are still 4.
    Thanks

    Hi Wendy,
    This is System Standard that If you increased Decimal Place then you can not decrease those decimal Place again.
    If you want this then you can do this in (Print of Document) Document Layout through Crystal Report.
    Hope this help
    Regards::::
    Atul Chakraborty

  • 0Person to 0employee loading, how to handle start and end date

    Hi
    I need help on some basic understanding of time dependent master data object.
    In my scenario i am loading 0employee and 0Person from R/3. I need to update 0employee from 0person.
    0employee
    BEGDA            ENDDA             PERNR        Position....................So many fields
    10.10.2001     10.10.2004        8000123    Associate
    11.10.2004     10.10.2008        8000123    Consultant
    11.10.2008     31.12.9999        8000123    Senior Consultant
    0Person
    BEGDA            ENDDA             PERNR         City....................So many fields
    10.10.2001     10.10.2003        8000123      Singapore
    11.10.2003     10.10.2007        8000123      Tokyo
    11.10.2007     31.12.9999        8000123      Newyork
    As the begining and end date are different i can't simply read City from 0person into 0employee. If i go for checking the city for the start and end date in 0employee, i will get multiple records ( If try to get city for 0employee's first record, i will get 2 city Singapore and Tokyo).
    Please help me out how to handle this ...... i think i am missing somelink somewhere
    Thanks
    Tripple k

    Hi Srini
    Yes i need to have parallel flow for both and in the cube where my reporting will be on monthly basis i need to read these 2 master data and get the required attributes ( considering last/first day of that month as per the requirement).......but i am just wondering this is common scenario....while there are so many threads written for populating 0employee from 0person......don't they have such requirement.....
    Thanks
    Tripple k

  • SQL loader : how to populate a calculated feild of a table?

    Hi All,
    I have a table which has total 92 columns, among them 6 feilds are calculated using few other fields of the same table.
    i have a csv file , which has only 86 feilds .
    during upload data using sql loader, is it possible to calculate other 6 feilds and upload them along with 86 fields ?
    Or any other method to populate the calculated values?
    Thanks in advance,
    Archana

    Hi Archana,
    You can have a script file with the required update commands and execute that script after the Loader loads the data to have them updated.
    But it is not a good practice to store the calculated values in the fields.
    Whenever required you can have them as a calculation in your select statements instead of storing them in the table.
    Unfortunately if the base values get changed you would be forced to recalculate and store them if you have them in the table.
    Regards,
    S.Muthukumar.

  • SQL LOADER: how to load CLOB column using stored function

    Hi,
    I am a newbie of sql loader. Everything seems to be fine until I hit a
    road block - the CLOB column type. I want to load data into the clob
    column using a stored function. I need to do some manipulation on the
    data before it gets saved to that column. But I got this error when I
    run the sql loader.
    SQL*Loader-309: No SQL string allowed as part of "DATA" field
    specification
    DATA is my CLOB type column.
    here is the content of the control file:
    LOAD DATA
    INFILE 'test.csv'
    BADFILE 'test.bad'
    DISCARDFILE 'test.dsc'
    REPLACE
    INTO TABLE test_table
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"'
    TRAILING NULLCOLS
    codeid          BOUNDFILLER,
    reason          BOUNDFILLER,
    Checkstamp     "to_date(:CHECKSTAMP, 'mm/dd/yyyy')",
    "DATA"          "GetContent(:codeid, :reason)"
    All references are suggesting to use a file to load data on
    CLOB column but I want to use a function in which it generates
    the content to be saved into the column.
    Any help is greatly appreciated.
    Thanks,
    Baldwin
    MISICompany

    *** Duplicate Post ... Please Ignore ***

Maybe you are looking for