External table. How to load numbers (scientific and decimal notation format)

Hi all, I need to load within a records in the external table that contain 7 fields. The last field is called AMOUNT and he has represented in some documents in decimal, in other documents in the format of scientific, notation for example, below:

CY001_STATU; 2009; Jan; 11220020GR;' 03900; CYZ900; -9, 99999999839929e-03
CY001_STATU; 2009; Jan; 11200100;' 60800; CYZ900; 41380,77

The external table script is the following:

CREATE TABLE HYP_DATA
(
COUNTRY VARCHAR2 (50 BYTE)
YEAR VARCHAR2 (20 BYTE).
PERIOD VARCHAR2 (20 BYTE).
ACCOUNT VARCHAR2 (50 BYTE),
VARCHAR2 (20 BYTE) DEPT,
ACTIVITY_LOC VARCHAR2 (20 BYTE),
AMOUNT VARCHAR2 (50 BYTE)
)
EXTERNAL ORGANIZATION
(TYPE ORACLE_LOADER
THE DEFAULT DIRECTORY HYP_DATA_DIR
ACCESS SETTINGS
(RECORDS DELIMITED BY NEWLINE
BADFILE ' HYP_BAD_DIR': ' HYP_LOAD.bad '.
DISCARDFILE ' HYP_DISCARD_DIR': ' HYP_LOAD.dsc '.
LOGFILE ' HYP_LOG_DIR': ' HYP_LOAD.log '.
SKIP 0
FIELDS TERMINATED BY '; '.
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL FIELDS ARE NULL
(
Tank of 'COUNTRY ', he said.
'YEAR' tank,.
Chariot of the "PERIOD."
Char 'ACCOUNT ',.
'DEPT' tank,
"ACTIVITY_LOC," tank
Char 'AMOUNT. '
)
)
LOCATION (HYP_DATA_DIR: 'Total.txt')
)
REJECT LIMIT UNLIMITED
NOPARALLEL
NOMONITORING;

If, for the field AMOUNT, I use VARCHAR (see above) data type, the table is loaded but I have some records rejected, and all these folders contain the AMOUNT in the field with scientific as notation:

CY001_STATU; 2009; Jan; 11220020GR;' 03900; CYZ900; -9, 99999999839929e-03
CY001_STATU; 2009; Feb; 11220020GR;' 03900; CYZ900; -9, 99999999839929e-03
CY001_STATU; 2009; Mar; 11220020GR;' 03900; CYZ900; -9, 99999999839929e-03
CY001_STATU; 2009; Dec; 11220020GR;' 03900; CYZ900; -9, 99999999839929e-03

All records with a decimal NUMBER are loaded correctly.

So my problem is that I NEED to load all the records (with the comma and the scientific notation format) together (without the rejected records), but I do not know what data type should I use for the field AMOUNT...

Someone has an idea?
Any help would be appreciated

Thanks in advance

Alex

@OP,
What version of Oracle are you using?
Just Cut the dough of your script and example woked FINE for me.

However my equation is... An external table will all LOAD data or not at all. How did you validate/conclude that...
I have a few records rejected, and all these folders contain the last field AMOUNT with scientific notation

select * from v$version where rownum <2;
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi

select * from mydata;
CY001_STATU     2009     Jan     11220020GR     '03900     CYZ900     -9,99999999839929e-03
CY001_STATU     2009     Feb     11220020GR     '03900     CYZ900     -9,99999999839929e-03
CY001_STATU     2009     Jan     11220020GR     '03900     CYZ900     -9,99999999839929e-03
CY001_STATU     2009     Jan     11200100     '60800     CYZ900     41380,77
CY001_STATU     2009     Mar     11220020GR     '03900     CYZ900     -9,99999999839929e-03
CY001_STATU     2009     Dec     11220020GR     '03900     CYZ900     -9,99999999839929e-03
CY001_STATU     2009     Jan     11220020GR     '03900     CYZ900     -9,99999999839929e-03
CY001_STATU     2009     Jan     11200100     '60800     CYZ900     41380,77

Table MYDATA script is...

drop table mydata;
CREATE TABLE mydata
(
COUNTRY VARCHAR2(50 BYTE),
YEAR VARCHAR2(20 BYTE),
PERIOD VARCHAR2(20 BYTE),
ACCOUNT VARCHAR2(50 BYTE),
DEPT VARCHAR2(20 BYTE),
ACTIVITY_LOC VARCHAR2(20 BYTE),
AMOUNT VARCHAR2(50 BYTE)
)
ORGANIZATION EXTERNAL
( TYPE ORACLE_LOADER
DEFAULT DIRECTORY IN_DIR
ACCESS PARAMETERS
( RECORDS DELIMITED BY NEWLINE
BADFILE 'IN_DIR':'HYP_LOAD.bad'
DISCARDFILE 'IN_DIR':'HYP_LOAD.dsc'
LOGFILE 'IN_DIR':'HYP_LOAD.log'
SKIP 0
FIELDS TERMINATED BY ";"
MISSING FIELD VALUES ARE NULL
REJECT ROWS WITH ALL NULL FIELDS
(
"COUNTRY" Char,
"YEAR" Char,
"PERIOD" Char,
"ACCOUNT" Char,
"DEPT" Char,
"ACTIVITY_LOC" Char,
"AMOUNT" Char
)
)
LOCATION (IN_DIR:'total.txt')
)
REJECT LIMIT UNLIMITED
NOPARALLEL
NOMONITORING;

VR,
Sudhakar B.

Tags: Database

Similar Questions

  • How to load the date and time from text file to oracle using sqlloader table

    Hi friends

    I need you to show me what I miss loading date and time text file in a table oracle using sqlloader

    It's my data in this way (c:\external\my_data.txt)
    7369,SMITH,17-NOV-81,09:14:04,CLERK,20
    7499,ALLEN,01-MAY-81,17:06:08,SALESMAN,30
    7521,WARD,09-JUN-81,17:06:30,SALESMAN,30
    7566,JONES,02-APR-81,09:24:10,MANAGER,20
    7654,MARTIN,28-SEP-81,17:24:10,SALESMAN,30
    my table in the database emp2
    create table emp2 (empno number,
                      ename varchar2(20),
                      hiredate date,
                      etime date,
                      ejob varchar2(20),
                      deptno number);
    the code for the control in this path (c:\external\ctrl.ctl) file
    load data
     infile 'C:\external\my_data.txt'
     into table emp2
     fields terminated by ','
     (empno, ename, hiredate, etime, ejob, deptno)
    This is the error:
    C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
    
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Commit point reached - logical record count 5
    
    C:\>
    any help that I enjoyed

    Thank you

    Published by: user10947262 on May 31, 2010 09:47

    load data
    INFILE 'C:\external\my_data.txt '.
    in the table emp2
    fields completed by «,»
    (empno, ename, hiredate, etime, Elysa, deptno)

    Try

    load data
     infile 'C:\external\my_data.txt'
     into table emp2
     fields terminated by ','
     (empno, ename, hiredate, etime "to_date(:etime,'hh24:mi:ss')", ejob, deptno)
    

    This is the error:

    C:\>sqlldr scott/tiger control=C:\external\ctrl.ctl
    
    SQL*Loader: Release 10.2.0.1.0 - Production on Mon May 31 09:45:10 2010
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Commit point reached - logical record count 5
    
    C:\>
    

    This isn't a mistake, you can see errors in the log file and bad.

  • External table of hourly load

    Hello

    How can I plan to load the external table?

    I have the external table and the target table, so I want to plan the following statement:

    Insert into target_table as
    Select * from external_table


    What is the best approach? To create a stored procedure and the calendar?

    Thank you
    Alex

    Creating DBMS_SCHEDULER job and schedule it to run on time.

    SY.

  • How to load procedures arrival and departure GPS

    Hello

    I have been using Microsoft flight Sim X for the last month to help me become current once more with my real world driving skills that I learned in the Air Force. I am now using this Flight Simulator help me prepare for the tests of flying commercial to reach my license of civil commercial flight. I found this Flight Simulator useful enough to bring my skills to the height.
    However, when I try to use the Garman GPS device with this Simulator, I am not able to load and use procedures IFR arrival and departure . On the page 'button of procedures' of the Garman GPS, it shows arrival and departure at the bottom of this page titles but does not allow to load or select one arrival or departure from any airport.

    Don't confuse not arrived and departure with approaches. I have no problem using the procedures of approaches to airports. The Help Center for this simulator game [which goes into the details of using the Garman GPS] mentions that I'll be able to load the arrivals and departures and that it will be explained below, I have... "to activate an arrival or a departure follow steps later in this section. I can't find anywhere where it says how to perform this loading/activation of the procedures of departure or arrival.

    Arrivals and departures flight for professional pilots procedures is an essential to b practice skill. It seems that this Flight Simulator can accommodate the procedures of arrivals and departures, but I can't seem to access despite a careful search throughout all of the game literature.

    I would appreciate your help to solve this problem for me.

    Thank you

    Chad
    Thank you youThanksThanks

    Hi Chad,

    The question you posted would be better suited in the Flight Simulator X support forums. I suggest you support professional technique contact Flight Simulator X for assistance on this issue.

    http://support.Microsoft.com/GP/games-for-Windows

    http://www.Microsoft.com/products/games/FSInsider/tips/pages/ContactingTechnicalSupport.aspx

    It will be useful.

  • How to load the CSS and JavaScript of JQuery UI inside edge led

    Hi I am using the JQuery UI inside edge slider but it doesn't work, I don't know what files should I download and how to include Javascript and CSS and images of the theme within the edge life, if someone has a code example from the compistionready what should I write on it and what is the folder structure files of the user interface and how to import them?

    Thanks in advance

    What is your configuration?

    1. you need to load the file ui.js as in this example for draggable. Include the correct version of jquery UI. If you need a file css then you load too.

    () yepnope

    {

    Nope:]

    "js/jquery-ui-1.9.2.custom.min.js,"

    ' css/jquery-ui.1.9.2.custom... min.css',.

    ],

    full: init

    }

    );

    2. / then you get your code for the slider - everything you need.

    function init() {}

    var mySlider = sym.$("mySlider");

    mySlider.draggable ({disabled: false});

    mySlider.draggable ({axis: "x"});

    }

  • To view the details of the table, how can I create users and applications for the dev team?

    Hello
    Veiw the tables as column details, etc., we use the password apps by oracle apps Forms.But apps password giving the development of values is threat to security. My question, how the development team will check the details of the database other than the apps user & password? No work around for this problem?

    Naya,

    The developers must have access to the development/TEST instance but must not be connected directly to the instance of PROD. Assuming that your development instance is identical to the production, I believe that the best scenario is to prepare reports on the development instance (having full access including password apps), and once they are done, they go to the ADMINISTRATOR to upload it to the production instance.

  • Linked excel tables in InDesign CS5 update problems and keep the formatting: need help

    I've been using excel to place several tables in my InDesign CS5 document which will require the update on a regular basis. The tables are already formatted in excel, so I will place in InDesign with formatting and you will usually have to reduce proportionally the tables as soon as they are in InDesign CS5. When I'll update the links, it is important the content of the tables as part of current text with larger text and I am unable to "Insert the picture content" or "shrink content proportionally." Nobody knows how to solve this problem or know of another way to link excel with formatting tables and update without having to reformat the table (i.e. to resize the image and text) every time that happens an update? Thank you!!

    Can't do it, sorry. Tables only.

    Bob

  • Difference between external tables and sql * loader

    Hello

    Could you please tell me the difference between
    tables external and sql * loader

    I have serached on the net but did ' get correct idea

    Please help me

    1 SQL LOADER can be run on the network (from any client computer), external tables can't

    2. return to the Oracle 9, external Tables could not load CLOB/BLOB (Oracle10 changed it)

    3 oracle 11 external tables have preprocessor, which is pretty dam characteristic cool - running essentially any OS command e.g. decompress before external table run. What's even better is the fact that the result of the operating system command is the source of the outer table, which means that there are no required temporary file (unzip the tracks and the output is the source of the external table). There are several ways to great use this - look at my blog for samples rare http://jiri.wordpress.com/2010/01/19/no-more-unix-scripts-in-11-2/

    4. as long as the 009 stressed, filed external load anything, they show just. Think of it more as load on request - it's great if you have old files archived and one or two users what to see content once a while

    5. external tables require no user access to the operating system, it is oracle environment pure - this may seem minor but for me it's huge. The fact that the ETL needs no special unix, no control file command and uses the simple SQL and DDL is nice and important

    6. external tables can load more text files, Oracle export dump files can be loaded, perhaps in the future more formats will be supported (hopefully all right excel format?)

    now the same thing to kill the myth - the TWO are EXACTLY the same when it comes to speed, I would actually drive of the external tables before will be faster because sql loader is old technology oracle doesn't really develops more

  • How can we not consider a field missing for external tables

    My to Oracle. East of 10 gr 2
    I created an external table using the following syntax:

    create the table ext_table
    (a number (5),)
    b number (5),
    c varchar2 (1000))
    external organization
    (type ORACLE_LOADER
    FLAISTD default directory
    access parameters (records delimited by newline
    fields ended by "#".
    (a char (5),
    b tank (5),
    c char (1000)))
    location ("file.csv")
    );

    My problem is the following. I have a file. XLS I save as a file. CSV sometimes any line of the file. XLS for young woman of the last column and so in my folder. CSV, I can have something like this:

    123 123 # #xxx
    456 #456

    and when I try to execute a select * from ext_table, I get an error because he expects a missing field.
    How can I do? 'Say' in the table create above something alert who could miss the last field?

    Thanks in advance!

    Solomon Yakobson says:
    Use TRAILING NULLCOLS:

    Oops, this isn't the external table of SQL * Loader. So it should be MISSING FIELD VALUES ARE NULL:

    create table ext_table
    (a number(5),
    b number(5),
    c varchar2(1000))
    organization external
    (type ORACLE_LOADER
    default directory TEMP
    access parameters (records delimited by newline
    fields terminated by "#" missing field values are null
    (a char(5),
    b char(5),
    c char(1000)))
    location ('file.csv')
    );
    
    Table created.
    
    SQL> select  *
      2    from  ext_table
      3  /
    
             A          B C
    ---------- ---------- ----------
           123        123 xxx
           456        456
    
    SQL>
    

    SY.

  • Direct load in external tables

    Can we use direct load in external tables? or set DIRECTLY in the external table script?

    Thank you.

    polasa wrote:
    Can we use direct load in external tables? or set DIRECTLY in the external table script?

    Thank you.

    N ° why? Because an external table does not load data. It's more like a pointer and an instruction how to read a file.

    The big difference between SQL Loader and an external table, SQL Loader is actually two things.

    (a) it reads a file from the file system
    (b) it inserts these values into a table in the database.

    An external table only one).

    However, you can do a quick insertion of this external table in an actual database table so that is sought.

    insert /*+append */ into myRealTable (colA, ColB, colC)
    select  * from myExternalTable
    

    Append it and perhaps also the parallel indication will be close to a direct path insert.

  • How to load and you unsubscribe contacts of the group e-mail to the E10?

    I know how to load new contacts and worldwide unsubscribe them but I'm trying to figure out how to unsubscribe them only to the Group an email because we have several brands. Someone knows how to do this in E10? Thank you

    Hi Rebecca

    One way I've seen to do would be to put everyone in a list shared during the download.

    Then, build a small program that has a stage for them to unsubscribe from the campaign. Add the list shared in the program and this will be done.

  • Error importing CSV files with "hidden" characters using the external Table

    Hi people

    Bit of a strange here.

    Well, we are accustomed to the use of the external Table method to load data from CSV files in the database, but a recent event presented us a problem.

    We have received some CSV files that "look like" regular CSV files, but Oracle will not load them.

    When we looked at the CSV using VIM on a UNIX machine, we saw the following characters 'hidden' between each regular character in the file.
    ^@
    If a string that looks like this when opened in Excel/Wordpad etc.
    "TEST","TEXT"
    Looks like this when exmained with VIM
    ^@"^@T^@E^@S^@T^@"^@,^@"^@T^@E^@X^@T^@"
    Has anyone encountered this before?

    Thank you very much

    Simon Gadd
    Oracle 11g 11.2.0.1.0

    Hi Simon,.

    ^ @ represents the ZERO character (0x00).
    So, most likely, you have a file encoded in Unicode.

    You need to specify the character set in the record specification (and if necessary the byte order mark), for example:

    CREATE TABLE ext_table
    (
      col1 VARCHAR2(10),
      col2 VARCHAR2(10)
    )
    ORGANIZATION EXTERNAL
    (
      TYPE ORACLE_LOADER
      DEFAULT DIRECTORY dump_dir
      ACCESS PARAMETERS
      (
       RECORDS DELIMITED BY '
    ' CHARACTERSET 'UTF16'
      FIELDS TERMINATED BY ','
      )
      LOCATION ('dump.csv')
    )
    REJECT LIMIT UNLIMITED;
    

    http://download.Oracle.com/docs/CD/E11882_01/server.112/e16536/et_params.htm#i1009499

  • Sqlloader Vs external Tables

    HII All,
    Currently, we use sqlloader. But now we are stuck to the top with a question. The problem is that in our production environment that they have installed customer sqlldr in the application server and the feed file in place in the Oracle server machine.

    We tried everything to stay with sqlloader but nothing works very well. I tried with ftp to transfer the file from Oracle server to the client machine, but we use the secure port it did not work.

    But this was easily accomplished using external table that the file is located in the server. But now I need to satisfy my clients by proving the external tables are relatively better.

    I have google for Sqlloader vs. external this debate.

    But I found no strong points supporting external tables.

    I had also gone through the following links

    http://asktom.Oracle.com/pls/asktom/f?p=100:11:0:P11_QUESTION_ID:6611962171229

    http://www.orafaq.com/Usenet/comp.databases.Oracle.misc/2007/02/13/0222.htm

    So please help me by providing some plus points and other links.

    Concerning
    Rambeau

    792353 wrote:
    Yes, it's really a good point, but can be achieved once the data has been pumped into staging tables.

    Who would take more space on the database, while the external tables you can do anything as the data is read. External tables would seem better in this regard.

    And now, we are not concerned with all the functions for use in DEC.

    People argue with me if we use external tables, we need create objects 2 db (1 external and more temporary table) which is just 1 intermediate table if sqlloader.

    You only need the external table definition. If you create a temporary table with this depends on your needs and the need to have such a table "staged." Even if you did in SQL * Loader you would always create a staging table, if there is really no difference...

    External table = 1 table definition and no data loaded in the database
    SQL * Loader = 1 table and the data loaded into the database

    Also read that when the feed file is huge its better to opt for sqlloader as it can circumvent sql analysis by choosing a DIRECT approach. Isisnt it?

    External tables using SQL * Loader under the hood engine, so there is no real difference except where you want to keep your data (in the file, or load a copy first on the database). You can use the parallel with external tables to load using multiple threads, you can use the indicator append to load the data as in the direct approach of sql * loader.

    So, kindly suggest me which is the best approach in a long-term process.

    In the long term, the external tables are the best approach. They were introduced after SQL * Loader to provide an improved mechanism. If they were not better, Oracle would not have taken the trouble with them. They also have the advantage that the control of their use is on the database, i.e. no need to control files, no need to run a command-line utility, not two floors (loading then treatment) treatment.

    There is no real reason for the use of SQL * Loader everything but more, the strange unique circumstance where you need to download data from a client computer (which will raise the question why a client machine has data on it in the first place!)

  • Add 'jump 1' to the definition of the external table after...?

    I created several external new definitions from file table definitions, but when the 'production' files have been created have now a header row at the top which should be ignored for not to be taken as data.

    Is there a way to "Edit" the file or definition the definition of the external table to add the mention "jump 1' without having to recreate the definition file to re-import the file and then recreate the external table?

    I remember there is a place in the file import process that asks the number of lines to skip.

    Thank you very much!!

    -gary

    P.S. This is indeed an OWB 10.1.0.4 environment but I guess he would hold even to 11g as well. :-)

    Hi Gary,.
    It seems OWB10g R1 does not setting property to jump (for the creation of the external table or SQL * Loader control file).

    But for OWB10g R2 and later it is possible:
    (1) in the Properties window of the file on the general tab, change "number of lines to skip.
    (2) synchronize the corresponding external table and deploy

    Kind regards
    Oleg

  • the external table DDL contains the owbunuseX in the list of fields

    Hello, we have defined an external table in design OWB11.1 Center, and we have defined columns such as "Field1, Field2,... field50', but when it was generated, we found owbunused0, owbunuse1... in the field of access settings list." Why the domain name is not same as the column in the external table name? Thank you.

    Hi Gary

    OK, now I see. For a table outside right click on it in the Designer tree and click the option synchronize, you will then get a dialog box to sync and when you regenerate you should be good to go.

    As other objects external Table may be related to another object, the file (in this case). So that you can make the external table if you change the file (in the same way with the mapping, when you modify a table, you can synchronize the table in and out of the mapping).

    See you soon
    David

Maybe you are looking for