To load multiple records in multiple tables from target

I have read several records as a set of a file flat source unique and load in the different target tables.
I have to read 3 discs as a game and load different targets in 3 tables and read another 3 disks as a game and load in the previous tables 3 target and it will
until all of the records from flat file are loaded.
The structure of the file is as follows:
Header record
Record line
Record distribution
Header record
Record line
Record distribution
....
....
... ...

Read the header record and load into the target table
Record line to read and load in the target B table
Record Distribution to read and load in the target C table
-Repeat the same steps until all records are read and loaded into the target tables.

I would be grateful if anyone can suggest the best approach to the design of interface/package and error conditions to manage?

Thank you
RAM

Hello

in this case you must create the data store depending on a model "Flat file".
For example, create 3 store data with the same resource (file), but change the column definition
Usually on the first column, set the 'model' for each specific format "variable code.

You create 3 interfaces and load your target (for example database table)

Concerning

Stéphane

Tags: Business Intelligence

Similar Questions

  • SQL * Loader - rejected records - error on table ORA-01722: invalid number

    Get the following errors:

    Please tell me where I'm wrong?
    The log file and extracts the data file with the control file is attached.
    Also guide me please how I can download 4900 files at once?

    -------------------------------------
    SQL * Loader: release 11.1.0.7.0 - Production on Fri 14 Oct 03:06:06 2011

    Copyright (c) 1982, 2007, Oracle. All rights reserved.

    Control file: sample.ctl
    Data file: Cities.csv
    Bad leadership: Cities.bad
    Discard File: none is specified

    (Allow all releases)

    Number of loading: ALL
    Number of jump: 0
    Authorized errors: 50
    Link table: 64 lines, maximum of 256000 bytes
    Continuation of the debate: none is specified
    Path used: classics

    Table CITY, loaded from every logical record.
    Insert the option in effect for this table: INSERT

    Column Position Len term Encl. Datatype name
    ------------------------------ ---------- ----- ---- ---- ---------------------
    FIRST ID *, CHARACTER
    35. ACCORDING TO NAME, ' CHARACTER
    COUNTRYCODE 3, ' CHARACTER
    THE NEXT POPULATION * CHARACTER WHT

    Sheet 1: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 2: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 3: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Folder 4: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 5: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 6: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 7: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 8: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    File 9: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Case 10: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Factsheet 11: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 12: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    File 13: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Fact sheet 14: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Fact sheet 15: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 16: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    File 17: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 18: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    File 19: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 20: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 21: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Account 22: rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 23: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record number of 24: rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 25: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Fact sheet 26: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Fact sheet 27: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 28: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 29: rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 30: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record of 31: rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    • Statement 32: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 33: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Page 34: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 35: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 36: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 37: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 38: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 39: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 40: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 41: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Page 42: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 43: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Sheet 44: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 45: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    • Statement 46: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 47: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 48: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 49: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Page 50: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number

    Record 51: Rejected - error on the table CITY, POPULATION column.
    ORA-01722: invalid number


    NUMBER of MAXIMUM ERRORS EXCEEDED - above the statistics reflect partial performance.

    CITY table:
    0 rows successfully loaded.
    51 lines not filled due to data errors.
    0 rows not loading because all WHEN clauses were failed.
    0 rows not populated because all fields are null.


    The space allocated to bind table: 35840 bytes (64 lines)
    Bytes of read buffer: 1048576

    Total logical records ignored: 0
    Total logical records read: 64
    Total rejected logical records: 51
    Total logical records ignored: 0

    Run started on Fri 14 Oct 03:06:06 2011
    Run finished Fri Oct 14 03:06:12 2011

    Time was: 00:00:06.18
    Time processor was: 00:00:00.03



    ----------------------------------------------------------------------

    my control file (sample.ctl):

    Load data infile 'Cities.csv '.
    in the town of table
    fields completed by «,»
    (external id integer,
    char (35) name box by ' ', '
    CountryCode tank (3) box by ' ', '
    external population integer terminated by '\n '.
    )

    my data (Cities.csv) file (it contains 4900 documents, but I show here just 4 records for ease)

    3830, "Virginia Beach", "USA", 425257
    3831, 'Atlanta', 'USA', 416474
    3832, "Sacramento", "USA", 407018
    3833, 'Oakland', 'USA', 399484


    Thanks in advance!

    Watch when I have a little change your database as follows

    1,'Kabul','AFG',1780000
    2,'Qandahar','AFG','237500'
    3,'Herat','AFG','186800'  
    

    I got the same error (last 2 rows rejected for the same number invalid error)

    mhouri > select * from cities;
    
            ID NAME                                COU POPULATION
    ---------- ----------------------------------- --- ----------
             1 Kabul                               AFG    1780000
    
    SQL*Loader: Release 10.2.0.3.0 - Production on Fri Oct 14 10:38:06 2011
    
    Copyright (c) 1982, 2005, Oracle.  All rights reserved.
    
    Control File:   cities.ctl
    Data File:      cities.dat
      Bad File:     cities.bad
      Discard File:  none specified
    
     (Allow all discards)
    
    Number to load: ALL
    Number to skip: 0
    Errors allowed: 50
    Bind array:     64 rows, maximum of 256000 bytes
    Continuation:    none specified
    Path used:      Conventional
    
    Table CITIES, loaded from every logical record.
    Insert option in effect for this table: INSERT
    
       Column Name                  Position   Len  Term Encl Datatype
    ------------------------------ ---------- ----- ---- ---- ---------------------
    ID                                  FIRST     *   ,       CHARACTER
    NAME                                 NEXT    35   ,    '  CHARACTER
    COUNTRYCODE                          NEXT     3   ,    '  CHARACTER
    POPULATION                           NEXT     *  WHT      CHARACTER            
    
    Record 4: Rejected - Error on table CITIES, column ID.
    Column not found before end of logical record (use TRAILING NULLCOLS)
    Record 2: Rejected - Error on table CITIES, column POPULATION.
    ORA-01722: invalid number
    
    Record 3: Rejected - Error on table CITIES, column POPULATION.
    ORA-01722: invalid number
    
    Table CITIES:
      1 Row successfully loaded.
      3 Rows not loaded due to data errors.
      0 Rows not loaded because all WHEN clauses were failed.
      0 Rows not loaded because all fields were null.
    
    Space allocated for bind array:                  35840 bytes(64 rows)
    Read   buffer bytes: 1048576
    
    Total logical records skipped:          0
    Total logical records read:             4
    Total logical records rejected:         3
    Total logical records discarded:        0
    
    Run began on Fri Oct 14 10:38:06 2011
    Run ended on Fri Oct 14 10:38:06 2011
    
    Elapsed time was:     00:00:00.23
    CPU time was:         00:00:00.09
    

    Value of the population within the data file must be a number

    Best regards

    Mohamed Houri

  • to add records to one table from another

    Hello gurus

    I have a table in which I have a few files... now, I want to add in the documents of table A of another table B has the same structure and columns.

    Y at - it a command for it
    insert into A
    select * from B;
    
  • How to insert records into a table from a button?

    Hey,.

    I use Oracle form and I have a trigger button when button pressed.

    I have a project being given for one of my classes. Basically, I have a Customers table and they hit the news. When they press submit, it must insert it into the table.

    And here is the code I wrote to be inserted inside the button

    declare


    v_cust_id customer_detail.customer_id%type;

    v_f_name customer_detail.fname%type;

    v_l_name customer_detail.lname%type;

    v_destination customer_detail.destination%type;

    v_travel_date customer_detail.travel_date%type;

    v_address customer_detail.address%type;

    v_telephone customer_detail.telephone%type;


    Start

    insert into customer_detail

    values (v_customer_id, v_fname, v_l_name, v_destination, v_travel_date, v_address, v_telephone);

    end;

    /


    But its gives me an error. Is a PLsql Oracle form different syntax?

    Why do you need to insert in the command, when applications oracle has this native features?

    Make a form based on the table and just use

    COMMIT_FORM; on your BUTTON.

    Hope this helps

    Hamid

  • Performance in the treatment of the based on a game, several tables from target

    Welcome.

    I have question about a treatment based on a game, when mapping have several tables in the target. I noticed that OWB generate SQL code that usually build a query for each table in the target insertion. Suggest that each table has results from different stages of the treatment, so multi table insert cannot be used. Looking for generated code PL/SQL, I feel that each insert query managed independently and so each make analyses of source table and joins on its own.
    To make my question more concrete, I will introduce two simple examples of stream ETL:
    1) start-> (table scan)--> (joins)--> (inserting into the table t1)
    2) start-> (table scan)--> (joins)-> two targets: (insert into table t1)
    -> two targets: (deduplicator)--> (insertion in table t2)
    Admit, that scans and joins are very expensive comparing to insert rows. Thus, it is usually, if oracle performs scans of tables 2 and joined in example 2) and example 2) take twice longer than example 1)?
    Or fact Oracle is so smart that it can cache the result of entering the first query and use it again in the second query?

    Best regards
    Pawel

    Hi Pawel,

    Thus, it is usually, if oracle performs scans of tables 2 and joined in example 2) and example 2) take twice longer than example 1)?

    Yes, you are right

    Or fact Oracle is so smart that it can cache the result of entering the first query and use it again in the second query?

    Nor the database Oracle or OWB don't is not to intermediate capabilities query result caching.
    While the Oracle database feature "result cache queries", but it must match exactly to SQL source and it store only the final query result...

    Kind regards
    Oleg

  • Problem with Create Table from target in CKM Oracle

    In CKM following Oracle are:
    create table < % = snpRef.getTable ("L", "CHECK_NAME", "W") % >
    (
    Catalog_name < %=snpRef.getDataType ("DEST_VARCHAR", "100", "") % > < % = snpRef.getInfo ("DEST_DDL_NULL") % >.
    Schema_name < %=snpRef.getDataType ("DEST_VARCHAR", "100", "") % > < % = snpRef.getInfo ("DEST_DDL_NULL") % >.
    RESOURCE_NAME < %=snpRef.getDataType ("DEST_VARCHAR", "100", "") % > < % = snpRef.getInfo ("DEST_DDL_NULL") % >.
    FULL_RES_NAME < %=snpRef.getDataType ("DEST_VARCHAR", "100", "") % > < % = snpRef.getInfo ("DEST_DDL_NULL") % >.
    ERR_TYPE < %=snpRef.getDataType ("DEST_VARCHAR", "1", "") % > < % = snpRef.getInfo ("DEST_DDL_NULL") % >.
    ERR_MESS < %=snpRef.getDataType ("DEST_VARCHAR", "250", "") % > < % = snpRef.getInfo ("DEST_DDL_NULL") % >.
    CHECK_DATE < %=snpRef.getDataType ("DEST_DATE", "", "") % > < % = snpRef.getInfo ("DEST_DDL_NULL") % >.
    ORIGINAL < %=snpRef.getDataType ("DEST_VARCHAR", "100", "") % > < % = snpRef.getInfo ("DEST_DDL_NULL") % >.
    CONS_NAME < %=snpRef.getDataType ("DEST_VARCHAR", "35", "") % > < % = snpRef.getInfo ("DEST_DDL_NULL") % >.
    CONS_TYPE < %=snpRef.getDataType ("DEST_VARCHAR", "2", "") % > < % = snpRef.getInfo ("DEST_DDL_NULL") % >.
    ERR_COUNT < %=snpRef.getDataType ("DEST_NUMERIC", "10", "") % > < % = snpRef.getInfo ("DEST_DDL_NULL") % >
    )

    What is product is...
    create the table ETL_STAGING. SNP_CHECK_TAB
    (
    CATALOG_NAME VARCHAR2 (100 CHAR) NULL,
    SCHEMA_NAME VARCHAR2 (100 CHAR) NULL,
    RESOURCE_NAME VARCHAR2 (100 CHAR) NULL,
    FULL_RES_NAME VARCHAR2 (100 CHAR) NULL,
    ERR_TYPE VARCHAR2 (1 CAR) NULL,
    ERR_MESS VARCHAR2 (250 CHAR) NULL,
    CHECK_DATE DATE NULL,.
    ORIGINAL VARCHAR2 (100 CHAR) NULL,
    CONS_NAME VARCHAR2 (35 CHAR) NULL,
    CONS_TYPE VARCHAR2 (2 CHAR) NULL,
    ERR_COUNT NUMBER (10) NULL
    )

    Why it adds the word TANK in parenthesis? Anyone?

    Tom Cusick

    Hello

    Follow these steps:

    (1) go to the topology

    (2) physical architecture

    (3) modify the Oracle (directory) technology

    4) go to the tab "other".

    (5) change the "String Mask" (4º-text box) to: VARCHAR2 (%)

    That will solve the problem.

    Cezar Santos

  • Loading multiple data to an XML file?

    Hello

    I have a problem loading multiple data from the same XML file. In this XML file, I have a list of dishes, I want to add to a menu. So, how can I load more data from different branches of the XML file into my text fields?

    Thanks in advance,

    Rafael Carignato

    Found a way to do it. I created X text elements named "textbox1", "textbox2", etc. Here is the code:

    var i = 1;

    var message;

    $.ajax({)

    type: 'GET ',.

    URL: "books.xml"

    data type: "xml."

    success: function {(xml)

    ($xml).find('Book').each (function () {}

    var Work'stitle = $(this).find('Title').text ();

    var sAuthor = $(this).find('Author').text ();

    sGenre var = $(this).find('Genre').text ();

    message = Work'stitle + ',' + sAuthor + ', ' + sGenre;

    Console.log ("Message:" + message);

    Console.log ("i:" + i);

    SYM. $("textbox"_+_i).html (message);

    Console.log("");

    i ++ ;

    });

    },

    });

  • Use with need to collect in bulk to insert records from multiple tables

    Hello

    I plsql record type with several tables with multiple columns. so when I used bulk collect with education for ALL. I want to insert records in multiple tables.

    Please give me suggestions.

    ForAll is designed to be used with a single DML statement, which may include dynamic SQL statements. However, I do not know what advantage this will give you your list iteration save several times, one for each table - especially since there is an air show with SQL dynamic.

    Example 1 (dynamic SQL):

    begin

      ...

      forall i in vRecList.First..vRecList.Last
        execute immediate '
        begin
          insert into Table1 (Col1, Col2, Col3) values (:1, :2, :3);
          insert into Table2 (Col1, Col2, Col3) values (:1, :2, :3);
        end;' using vRecList(i).Col1, vRecList(i).Col2, vRecList(i).Col3;
    end;

    Another approach that I should work (but not tested) is using to insert all the Scriptures and based record inserts, but you need to try on your version of Oracle forall has changed between the versions.  In this case vRecList must be compatible with the Table % ROWTYPE and Table2% ROWTYPE type.


    Example 2 (insert all):

    begin

      ...

      forall i in vRecList.First..vRecList.Last

        insert all

          into Table1 values vRecList(i)
          into Table2 values vRecList(i)
        select 1 from dual;

    end;

  • Delete query to delete records from multiple tables

    All,

    I need a delete query that will delete the records from the tables. Please see the structure of the table & below
    CREATE TABLE TEMP1 (ID NUMBER(10),NAME VARCHAR2(40),CLASS VARCHAR2(40),COLLEGE VARCHAR2(40));
    CREATE TABLE TEMP2 (ID NUMBER(10),CITY VARCHAR2(40),STATE(40));
    
    INSERT INTO TEMP1 (ID, NAME,CLASS,COLLEGE) VALUES (1000,'SAM','CS','UNIV_1');
    INSERT INTO TEMP1 (ID, NAME,CLASS,COLLEGE) VALUES (2000,'RIO','CS','UNIV_1');
    INSERT INTO TEMP1 (ID, NAME,CLASS,COLLEGE) VALUES (3000,'CHRIS','CS','UNIV_1');
    INSERT INTO TEMP1 (ID, NAME,CLASS,COLLEGE) VALUES (4000,'ALEX','CS','UNIV_1');
    
    INSERT INTO TEMP2 (ID, CITY,STATE) VALUES (1000,'Auburn','NY');
    INSERT INTO TEMP2 (ID, CITY,STATE) VALUES (2000,'Ithaca','NY');
    INSERT INTO TEMP2 (ID, CITY,STATE) VALUES (3000,'Mount Vernon','NY');
    INSERT INTO TEMP2 (ID, CITY,STATE) VALUES (4000,'Port Jervis','NY');
    Now, I need to delete the records in these tables where the ID is '2000' by using a single delete query. Is this possible? This may be a newbie question. Help, please.

    "using a single request deletion. Is this possible?

    Nope.
    You can insert into multiple tables by using a single query, INSERT ALL job, but you cannot delete more than one table using a single query.

  • To create an interactive report in the apex by selecting from multiple tables

    Hi, I am creating an interactive report by selecting from multiple tables.

    SELECT w.FIRST_NAME as name, w.SURNAME as name, i.ROAD Road, i.DATE_OF_INC as DATE_OF_INC, S.STATEMENT as a STATEMENT OF Declaration

    JOIN THE

    WITNESS w

    ON w.witness_id = s.FK1_WITNESS_ID

    JOIN THE

    Incident I have

    WE

    i.incident_no = w.FK1_INCIDENT_NO

    JOIN THE

    user_station ps

    ON ps.station_id = i.nearest_station_id

    JOIN THE

    the user in.

    WE

    in. STATION_ID = ps.station_id

    WHERE po.officer_id = 1

    by I continue to encounter this error "the report query requires a unique key to identify each row. The supplied key cannot be used for this query. Please change the report attributes to define a unique key column. "ORA-01445: cannot select ROWID from where sample, a join without key preserved table view '

    So I googled around and found that in the attibutres tables report, I need to change the "LINK" COLUMN so first, I changed "Link to custom target", but the report is so I changed it to "Exclude link Clolumn" again, the report didn't report and I STILL got a blank page with only the tabs.

    I wonder you can not create a report by selecting from multiple tables?

    If you can please I need your help.

    Thank you

    You can, but in this case, it might be easier to build your report tables that are joined Oracle views and then build your report out of the newly built sight...

    Or wrap a selection around your selection with joins, and then make the where clause on the external selection...

    Thank you

    Tony Miller
    Software LuvMuffin
    Ruckersville, WILL

  • Update multiple columns from multiple tables in a single UPDATE request

    Hello

    I'm trying to figure if I'm heading in the right direction.

    I want to update multiple columns from multiple tables in a single UPDATE request. Also, I would like to update multiple columns in a table from the tables.

    Scenario 1

    UPDATE Table2, Table 3
    SET T2.Column1 = T1.Column1 
    ,T2.Column2 = T1.Column2
    ,T3.Column2 = T1.Column2
    FROM Table1 T1, Table2 T2, Table3 T3
    WHERE T1.id = T2.id
    and T1.id = T3.id
    
    

    Scenario 2

    UPDATE Table3
    SET T3.Column1 = T1.Column1 
    T3.Column2 = T1.Column2
    ,T3.Column3 = T2.Column3
    ,T3.Column4 = T2.Column4
    FROM Table1 T1, Table2 T2, Table3 T3
    WHERE T3.id = T1.id
    and T3.id = T2.id
    
    

    Hello

    For scenario 1, you must write separate instructions UPDATE table2 and table3.

    To guard against someone else change one of these tables while you act so you can copy all relevant data in a global temporary table and update this global temporary table table3.

    ENGAGE only when two tables have been changed.

    You can write a procedure or an INSTEAD OF trigger to do all this.

    For scenario 2, you can reference many tables that you need when new table3.  It might be more efficient and simpler to use the MERGER rather than UPDATED.  For example:

    MERGE INTO table3 dst

    WITH THE HELP OF)

    SELECT t1.id

    t1.column1

    t1.column2

    t2.column3

    t2.column4

    FROM table1 t1

    JOIN table2 t2 ON t1.id = t2.id

    )             src

    WE (dst.id = src_id

    WHEN MATCHED THEN UPDATE

    SET dst.column1 = src.column1

    dst.column2 = src.column2,

    dst.column3 = src.column3,

    dst.column4 = src.column4,

    ;

  • How to load multiple files into multiple tables using a Controlfile?

    Hello world

    I have four different tables with similar structures, get the data from four different data files. I would like to use one control file to load the data from four different files from four different tables.

    Here's the DOF of the tables:

    CREATE TABLE Product_Sales(  
        Year_of_Sale NUMBER,  
        Product_Type VARCHAR2(25 CHAR),  
        Product_Group VARCHAR2(25 CHAR),  
        Category_Type VARCHAR2(25 CHAR),  
        Category_Group VARCHAR2(10 CHAR),  
        Product_Count NUMBER,  
        Product_Amount NUMBER(19,2),  
        Category_Count NUMBER,  
        Category_Amount NUMBER(19,2)  
    )  
    
    

    CREATE TABLE Retail_Sales(  
        Year_of_Sale NUMBER,  
        Product_Type VARCHAR2(25 CHAR),  
        Product_Group VARCHAR2(25 CHAR),  
        Category_Type VARCHAR2(25 CHAR),  
        Category_Group VARCHAR2(10 CHAR),  
        Product_Count NUMBER,  
        Product_Amount NUMBER(19,2),  
        Category_Count NUMBER,  
        Category_Amount NUMBER(19,2)  
    )  
    
    

    You still have products_sales instead of product_sales in when your article, so it does not load anything in the product_sales table.  You have not reset the position for the first after subsequent field in the table and when clauses, then it starts looking for the first field to the position you left it in the previous section, instead of 1, so he can't find anything and does load all the data in the household_sales table.  You need to reset the position 1 for each combination of table and what clause after the first.  The first argument is optional.  Please see the corrected below control file.

    DOWNLOAD THE DATA

    INFILE 'output.txt '.

    IN THE PRODUCT_SALES TABLE TRUNCATE

    WHEN filename = "Product_Sales".

    FIELDS ENDED BY ',' POSSIBLY FRAMED BY ' '.

    TRAILING NULLCOLS

    (

    file name of FILLING,

    Year_of_Sale,

    Product_Type,

    Product_Group,

    Category_Type,

    Category_Group,

    Product_Count,

    EXTERNAL DECIMAL Product_Amount,

    Category_Count,

    EXTERNAL DECIMAL Category_Amount

    )

    IN THE HOUSEHOLD_SALES TABLE TRUNCATE

    WHEN filename = "Household_Sales".

    FIELDS ENDED BY ',' POSSIBLY FRAMED BY ' '.

    TRAILING NULLCOLS

    (

    filename FILLER POSITION (1),

    Year_of_Sale,

    Household_Type,

    Product_Group FILLING,

    Category_Type FILLING,

    Category_Group FILLING,

    Product_Count,

    EXTERNAL DECIMAL Product_Amount,

    Category_Count,

    EXTERNAL DECIMAL Category_Amount

    )

  • to insert multiple records in another table

    Hi all;

    How can I increase the number of records in the table?

    SQL > insert into tab2 to select * From tab1;

    Enter tab2 to select * From tab1

    *

    ERROR on line 1:

    ORA-00926: lack of keyword VALUES

    Hi try this...

    Insert in tab2 select * from tab1

  • Get the updated record the last based on the Date and the van of the user ID corresponding (multiple tables)

    Hello people,

    I currently have a working for this using PL/SQL solution, but it would be nice to have it using SQL. Any help is appreciated and once again, to your practice time.

    I'm looking to pick up the most recent date and the corresponding user that updated registration for a student in particular. There are two tables T1 and T2. The most recent date can be the create_date or modified_date of T1 or T2.

    Scripts for creating the table and INSERT statements:

    create table T1
      ( code           varchar2(4),
        create_date    date,
        create_userid  varchar2(20),
        modified_date  date,
        modify_userid  varchar2(20));
    
    create table T2
      ( code           varchar2(4),
        visit_id       number,
        visit_date     date,
        create_date    date,
        create_userid  varchar2(20),
        modified_date  date,
        modify_userid  varchar2(20));
    
    

    insert into T1 values ('1001',to_date('06-FEB-2013 09:12:12','DD-MON-YYYY HH24:Mi:SS'),'ROGER',to_date('12-APR-2013 13:01:12','DD-MON-YYYY HH24:Mi:SS'),'BRIAN');
    insert into T2 values ('1001',1,to_date('10-JAN-2013','DD-MON-YYYY'), to_date('10-JAN-2013 14:12:12','DD-MON-YYYY HH24:Mi:SS'),'ROGER',to_date('12-MAR-2013 12:01:06','DD-MON-YYYY HH24:Mi:SS'),'AMY');
    insert into T2 values ('1001',2,to_date('31-JAN-2013','DD-MON-YYYY'), to_date('12-MAY-2013 16:11:12','DD-MON-YYYY HH24:Mi:SS'),'GRACIE',null,null);
    
    insert into T1 values ('1002',to_date('12-JAN-2013 11:12:13','DD-MON-YYYY HH24:Mi:SS'),'LYNNELLE',to_date('12-APR-2013 13:01:12','DD-MON-YYYY HH24:Mi:SS'),'BRIAN');
    insert into T2 values ('1002',1,to_date('10-JAN-2012','DD-MON-YYYY'), to_date('10-JAN-2012 09:12:12','DD-MON-YYYY HH24:Mi:SS'),'ROGER',to_date('12-APR-2013 13:04:12','DD-MON-YYYY HH24:Mi:SS'),'AMY');
    insert into T2 values ('1002',2,to_date('10-JAN-2013','DD-MON-YYYY'), to_date('12-JAN-2013 11:12:13','DD-MON-YYYY HH24:Mi:SS'),'JOHN',null,null);
    
    insert into T1 values ('1003', to_date('04-FEB-2014 12:01:01', 'DD-MON-YYYY HH24:Mi:SS'), 'LYNNELLE', null, null);
    
    

    I want to show for the three codes are the following records:

    Code      Table Date                              User ID
    1001      T2  12-MAY-2013 16:11:12   GRACIE
    1002      T2 12-APR-2013 13:04:12   AMY
    1003 T1 04-FEB-2014 12:01:01 LYNNELLE
    
    

    1001 students, the most recent is the create_date of the visit count = 2 for the Code 1002, the most recent date comes from modified_date for visit 1 (its 3 seconds later than the T1 modified_date). Finally, for students 1003 (who did not all records in T2, the create_date is the only date and must be picked up.

    Thanks in advance.

    with t as)

    Select the code,

    NVL (MODIFIED_DATE, create_date) dt.

    case nvl (modified_date, create_date)

    When modified_date then modify_userid

    of other create_userid

    end userid,

    Tbl "T1".

    from t1

    Union of all the

    Select the code,

    NVL (MODIFIED_DATE, create_date) dt.

    case nvl (modified_date, create_date)

    When modified_date then modify_userid

    of other create_userid

    end userid,

    Tbl 'T2 '.

    the t2

    )

    Select the code,

    Max (TBL) keep (dense_rank last order by dt, tbl) tbl.

    Max (DT) dt,

    Max (UserID) keep (dense_rank last order by dt, tbl) userid

    t

    Code group

    order by code

    /

    CODE TO DT USERID
    ---- -- -------------------- --------------------
    1001 T2 MAY 12, 2013 16:11:12 GRACIE
    1002 T2 12 APRIL 2013 13:04:12 AMY
    1003 T1 4 FEBRUARY 2014 12:01:01 MANON

    SQL >

    SY.

  • Update using several terms from multiple tables

    Hello

    I'm quite new to PL/SQL.

    I need to update a record in a table with several conditions in which the clause of several tables.

    On the internet I found something like

    Update < table >
    Set < column > = < value >
    < Table >
    Join them < table >
    on < condition >
    Where < condition >
    And < another condition >

    Now, I have:

    Update outbound_order
    Set outbound_order_sorting_code = "A".
    to orderref o, oo outbound_order
    where oo.ordernumber = o.ordernumber
    and o.delivery_status = 'c ';

    It gives ORA00933 of Pl/SQL to->

    I can't use more than one table in update?

    Kind regards

    Chi Wai
    update outbound_order o
    set outbound_order_sorting_code = 'A'
    where exists(select 1 from orderref oo
                  where oo.ordernumber = o.ordernumber)
    and delivery_status = 'c';
    

Maybe you are looking for