Merge two tables to a view

I have two tables I have merged into a single view.
All rows from both tables to merge into a single view.

Not table 1 no criteria:
MATERIAL     PLANT     QUANTITY     UNIT     POSTING_DATE
Table 2 criteria:
MATERIAL     PLANT     SALES_QUANTITY     UNIT     POSTING_DATE     RECORD_TYPE
Where RECORD_TYPE IN('O','U')
The view should look like this:
MATERIAL     PLANT     QUANTITY     UNIT     POSTING_DATE
I'm not going anywhere, what should I do?

Hello

Maybe you want something like this:

CREATE OR REPLACE VIEW  table_1_and_ou_from_2
AS
     --
SELECT     material, plant,       quantity, unit, posting_date
FROM     table1
     --
UNION ALL
        --
SELECT     material, plant, sales_quantity, unit, posting_date
FROM     table2
WHERE     record_type     IN ('O', 'U')
;

The columns in the view will have the same names that the columns of the 1st branch of the UNION, then the 3rd column will be called quantity, not sales_quantity.

I hope that answers your question.
Otherwise, then, as mentioned above, post a small example data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and also publish outcomes from these data (that is, the content of the view).
Explain, using specific examples, how you get these results from these data.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum {message identifier: = 9360002}

Tags: Database

Similar Questions

  • Merge two tables 2D?

    Hello

    I have a question about the merger of the two 2D arrays. I have a program that generates two tables different interms of binary digits (attached file) and I wanted to arrange them as below.

    The first generation of table: 1110

    1101

    1011

    0111

    Second generated table: 0001

    0010

    0100

    1000

    Output should be: 1110

    0001

    1101

    0010

    1011

    0100

    0111

    1000

    Thank you.

    Hello

    Order the attached VI

    Kind regards

    Amine31

    (Give congratulations to good answers and Mark as a Solution If your problem is resolved)

  • Merge two tables or queries, not identical

    This is probably the dumbest question I posted again, but my mind is numb and I don't get anywhere, no matter how I google conditions.

    I have three tables in a MS Access database: owners, other vehicles. Owners is owner info, vehicles is car info, other info on various items. Vehicles and others have an OwnerID field which, funny, corresponds to the ID field in owners. What I'm trying to do is to shoot all the vehicles and all the other elements which belong to a single owner and have been added by a certain date. I'm obviously going to this topic back, because after two days ago to look at, I now have a working query syntactically who returns 739 records when he must return to 6. I think that this is a new personal record.

    I guess the first question is if I should run two separate queries (one for vehicles, one for the other) and merge them nicely with the CF code or pull all at once with a big request. No idea, so far, has worked. Hope, because the result is a report in the following format:

    Name of the owner
    Info vehicle here, sorted by date added
    Info vehicle here, sorted by date added
    Other info here, sorted by date added
    Other info here, sorted by date added
    -----------------------------------------------------------
    4 records

    Name of the owner
    Info vehicle here, sorted by date added
    etc etc.
    ------------------------------------------------------------
    # disks, etc.

    I failed a loop in separate queries, so here's the current Select statement.

    SELECT owners.ownerid, owners.fname, owners.lname, owners.bname,
    Vehicles.ID as vid, vehicles.ownerid as vownerid,
    Vehicles.Year as vyear, vehicles.mfr as vmfr, vehicles.model as vmodel,
    Vehicles.Price as vprice, vehicles.date_add as vdate_add,
    Other.ID as iid, other.ownerid as iownerid,
    Other.Year as iyear, other.mfr as imfr,
    Other.Model as imodel, other.item_name as iname
    Other.Price as iprice, other.date_add as idate_add
    Owners, vehicles, other
    WHERE (vehicles.ownerID = owners.ownerID
    AND vehicles.date_add < #createODBCDate (variables.begin_date) #)
    OR (other.ownerID = owners.ownerID
    AND other.date_add < #createODBCDate (variables.begin_date) #)
    ORDER BY vehicles.ownerID, vehicles. Date_add, other.ownerID, other.date_add

    Anyone has any idea where I should start? I know it shouldn't be this difficult.
    Thank you.

    Take another look at the posted solution by draves, try to remove other from OF in the first query, and vehicles FROM in the second, since nothing is selected where linked to, these tables in their respective applications. (I think it was probably just an oversight)

    Select x.*)
    SELECT "1" as skey, 'VEHICLE' as sname,
    Owners.ownerID, owners.fname, owners.lname, owners.bname,
    Vehicles.ID, vehicles.ownerid, vehicles.year, vehicles.mfr, vehicles.model,
    "like item_name, vehicles.price, vehicles.date_add
    Owners, vehicles
    WHERE vehicles.ownerID = owners.ownerID
    AND vehicles.date_add<>
    Union of all the
    SELECT "2" as skey, "The OTHER" as sname.
    Owners.ownerID, owners.fname, owners.lname, owners.bname,
    Other.ID, other.ownerid, other.year, other.mfr, other.model,
    Other.item_name, other. Price, other.date_add
    Owners, other
    WHERE other.ownerID = owners.ownerID
    AND other.date_add<>
    ) x
    ORDER BY lname, fname, ownerID skey, Date_add

    Phil

  • How to make an update of a view online two tables...

    When the unique constraint of the second table includes three columns?

    I have two tables A and B and I want to update a table column, one using an update of a view online two tables.

    Table A:
    col1 primary key
    col2

    Table B:
    col1 u1
    col2 u2
    COL3 u3
    COL4
    col5

    Table col1 primary key, table B has a unique constraint on col1, col2 and col3.

    Tables A and B are joined in this way:
    select  A.col1, A.col2 as KEY_OLD, B.col5 as KEY_NEW
    from    A, B
    where (B.col1 = 'literal_1') and (B.col2 = 'literal_2') and (A.col1 = B.col3) and (A.col2 = B.col4)
    And now, I want to update this view and set KEY_OLD = KEY_NEW.

    Because of the first three conditions in the where clause for each entry in the table A there is just a matching entry in the table B.
    So the table should be preserved in the join key.

    But during the update
    update (select  A.col1, A.col2 as KEY_OLD, B.col5 as KEY_NEW
                from    A, B
                where (B.col1 = 'literal_1') and (B.col2 = 'literal_2') and (A.col1 = B.col3) and (A.col2 = B.col4)
               )
    set     KEY_OLD = KEY_NEW;
    I get an error ORA-01779.

    I did the updates on inline views this way several times in recent weeks and it work very well.
    But so far the unique constraint on the table B was just a column ;-)

    So what I need is to make it work with the unique constraint on the application of the three-column table B.

    Thank you very much in advance for any help.

    Hartmut cordially

    Preserved key criteria must be met by the join columns, the optimizer does not agree (in fact I never tried in 11g) just a combination of columns, literals and join.

    The alternatives you have are subqueries online (which as you point out can do rather worse), the command MERGE or indicator BYPASS_UJVC semi undocumented.

  • ORA-01776: I can not insert a view consisting of two tables

    Hello:

    I'm doing an insert on a view composed by the join of two tables (services and employees) and it failed.

    The view is the following:

    CREATE OR REPLACE FORCE VIEW 'EMPDPTO' ('EMPLOYE_ID', 'LAST_NAME', 'EMAIL', 'HIRE_DATE', 'JOB_ID""DEPARTMENT_ID","DEPARTMENT_NAME") AS
    (
    SELECT employe_id, last_name, email, hire_date, job_id, d.department_id, department_name
    E employees, departments d
    WHERE e.department_id = d.department_id
    );


    My insert command

    INSERT INTO empdpto
    VALUES (743, 'Bermejo', '[email protected]', 12 December 09 ', 'IT_PROG', 10, 'Administration');

    get an ORA-01776: it is not possible to modify more than one table of base through a union to join.


    On the other side, I saw in the documentation which, in certain circumstances, can do an insert on a complex view.

    Is it possible to do an insert on a view consisting of two tables? Under what conditions?

    Thank you

    Reference of SQL CREATE VIEW http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_8004.htm#i2065510 views editable Notes section

    >
    If you want a view of join to be updated, then all of the following conditions must be met:

    *

    The DML must assign only one underlying table of the join.
    *

    An insert, the view does not create WITH CHECK OPTION, and all columns in which the values are inserted must come from a key preserved table. A key-preserved table is one for which each primary key or unique key in the base table value is also unique in the view of the join.
    *

    For an UPDATE statement, the view does not create WITH CHECK OPTION, and all updated columns must be extracted from a preserved key table.

    >

    The first condition is not true for the view that you created.

    Edited by: P. Forstmann on 26 Jan. 2010 20:17

  • Leave a distinct value in a materialized on two tables view

    Hi and thanks for reading,

    I have the following problem. I'm creating a materialized on two tables, with view "where a.id = b.id.
    The materialized result list display of multivalued twice. For example, a customer name has many direct contacts, and so the name of the customer is listed several times. Now I would like to add the name of each customer with just a contact detail, how can I do? (Even if I loose some information during this operation).

    Thank you

    Evgeny

    Ok. If you have CUSTOMER and CUSTOMER_CONTACT tables. Then, assuming that you don't care which contact to use, you can:

    SELECT  *
      FROM  CUSTOMER a,
            (
             SELECT  cc.*,
                     row_number() over(partition by id order by 1) rn
               FROM  CUSTOMER_CONTACT cc
            ) b
      WHERE b.id = a.id
        AND b.rn = 1
    /
    

    SY.

  • Does anyone know how to merge two workseets number for printing?

    How can I combine two spreadsheets in numbers for printing?

    Hi jj,

    I assume that you mean that you have a single document, which contains two worksheets, and that each sheet contains one table (only?).

    What do you mean by "merge two (booklets)?

    You mean you wan to place Tables of two leaves on a single sheet (this sheet would contain then both tables).

    Or do you mean you want to place all data on the two tables into a single table on one sheet?

    Or do you mean something different to both of these descriptions?

    Kind regards

    Barry

  • How to merge two slideshows macOSX

    I'm trying to merge two slideshow on my mac Pro or Imac. If possible, I would like to keep the original music in both. But it is not critical.

    Thank you

    Slide show projects cannot be merged.

    If you visit both attractions like a video, you can add the two points of view in iMovie and display a merged video.

    Otherwise, duplicate a slide show and add photos of the second presentation to the other.

    What version of iPhoto do you use?

  • NEED TO MERGE TWO ADMINISTRATIVE ACCOUNTS AND ALL THE FILES IN XP - NO WINDOWS 7! CANNOT FIND TRANSFER IFTO ANYWHERE.

    I desperately need to merge two administrative accounts on my laptop - using XP and NOT windows 7 (so there is no transfer Assistant). I need to transfer all of the OLD admin. account in the NEW Admin account.

    For the full backup used Carbonite - due erase hard drive and reinstall XP - carbonite cust. veeeeery slooooow service and I had to use the laptop for the preparatory work.  When the backup has been restored, he implemented the administrative account of origin, besides I have created a new.  Now, most of the files are under the old administrative account, and I need to move the OLD files in the NEW Admin account.

    Would sincerely appreciate your very specific instructions? ... step by step, if possible? Not quite a prolific technician, but no slouch, not more.

    Thank you very much!

    You can't really merge two accounts. You can copy data from one account to the other. Folder options > view tab > check "Show hidden files". Then go to:

    c:\Documents and Settings\name of the old account and copy the files to My Documents, desktop, Favorites in folders in your new user account. When you have all your stuff, you can delete the old user account from the control panel > user accounts. MS - MVP - Elephant Boy computers - don't panic!

  • Merge two favorite files - one of the former without losing new entries

    I'm trying to move the Favorites from one computer to another, without losing the favorites that have been added to the second computer, which can ONLY be the first. Once I have export favorites from the first computer on a port USB, import replace simply all the Favorites on the second computer folder or it will ask me if I want to record a new one to the old double the second favorite of the computer file (like when you save jpg files).

    Or is there another way to "merge" two folders, as visually opening upward both files and selecting what to switch to the hand...

    Thanx

    PS - am moving to Vista on a Windows 7 computer. as well as the synchronization of the two win 7 after that.

    Hi Maril,

    Thanks for posting your question in the Microsoft Community Forums.

    Based on the information, you find out when you try to move the Favorites from one computer to another, if the existing Favorites in the second computer will be deleted.

    Usually, when you import bookmarks to another computer, it will not replace the already existing bookmarks on the second computer.

    However, to be on the safer side, you can take a backup of the bookmarks on the second computer to another folder or another location.  Try favorites of the importation of the first computer to the second computer, check if you are able to access to existing favorites as well as any.

    If this is not the case, try adding the Favorites of the backup location to imported Favorites and check if it helps.

    You can also copy favorites from the second computer to the first computer and save it in a new folder. Try to create another folder containing the computer the two first and second Favorites and then import the Favorites from this folder to the second computer.

    For more information, see the article:

    Add, view, and organize Favorites

    Hope the helps of information.

    Let us know if you need help with Windows related issues. We will be happy to help you.

  • How to join two tables if you transpose the rows, columns and rows in one of the table

    Hi guys,.

    can someone help me please in the write request

    I have two tables

    Agents and Agent phones but in the agent phones table for the id of an agent it displays 4 rows because one of the column there types of different phones (office, mobile, home, fax)

    So instead of display 4 rows, I used max(case...) to convert rows to columns

    now how to reach it with another table

    Requirement:

    Database: 11.2.0.2.0

    create the table AGENT_PHONE

    (

    agent_id NUMBER (20) not null,

    agent_type_code VARCHAR2 (10) not null,

    agent_type_prefix VARCHAR2 (10) not null,

    Phone_Number VARCHAR2 (16) not null,

    phone_type_code VARCHAR2 (10) not null

    )

    CREATE TABLEAGENTS

    (

    agent_id NUMBER (20) not null,

    agent_type_code VARCHAR2 (10) not null,

    agent_type_prefix VARCHAR2 (10) not null,

    NAME VARCHAR2 (40) NOT NULL

    )

    INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)

    VALUES (29709, ARE ', 'OFFICE', '4805551436', 'CELL');

    INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)

    VALUES (29709, ARE ', 'OFFICE', '1111111111', 'PHONE');

    INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)

    VALUES (29709, ARE ', 'OFFICE', '2223334444',' OFF');

    INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)

    VALUES (29709, ARE ', 'OFFICE', '5556667788', 'FAX');

    INSERT INTO VALUES AGENTS

    (29709, ARE ', 'OFFICE', 'FLY');

    INSERT INTO VALUES AGENTS

    (1234, ARE ', 'OFFICE', 'MIKE');

    SELECT * FROM AGENT_PHONES

    AGENT_IDAGENT_TYPE_CODEAGENT_TYPE_PREFIXPHONE_NUMBERPHONE_TYPE_CODE

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

    29709REOFFICE4805551436CELL
    29709REOFFICE1111111111PHONE
    29709REOFFICE2223334444OFF
    29709REOFFICE5556667788

    FAX

    SELECT * AGENTS

    AGENT_IDAGENT_TYPE_CODEAGENT_TYPE_PREFIX

    NAME

    29709REOFFICEROB
    1234REOFFICE

    MIKE

    This is so the data we have in both table

    Now, I transposed rows to columns in the table of agent phones so I used the following query

    SELECT AP. AGENT_ID,. AGENT_TYPE_CODE,. AGENT_TYPE_PREFIX.

    MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'CELL' THEN AP. PHONE_NUMBER END) AS CELL.

    MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'OFF' THEN AP PHONE_NUMBER END) AS TURNED OFF.

    MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'FAX' THEN AP. PHONE_NUMBER END) LIKE FAX,.

    MAX (CASE WHEN PHONE_TYPE_CODE = 'PHONE'. THEN AP PHONE_NUMBER END) AS PHONE

    AGENT_PHONE AP

    WHERE AP. AGENT_ID = 29709

    GROUP OF AP. AGENT_ID, AP. AGENT_TYPE_CODE, AP. AGENT_TYPE_PREFIX.

    AGENT_IDAGENT_TYPE_CODEAGENT_TYPE_PREFIXCELLOFFFAXPHONE
    129709REOFFICE4805551436222333444455566677881111111111

    My question is how this to join the agents table so that my output should be like this...

    I want to display all the results in the table of the Agent, even if they are not in the table of agent phones. As you can see there are other agent id 1234 is also populated

    AGENT_IDAGENT_TYPE_CODEAGENT_TYPE_PREFIXNAMEAGENT_IDAGENT_TYPE_CODEAGENT_TYPE_PREFIXCELLPHONEOFFFAX

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

    29709REOFFICEROB29709REOFFICE4805551436111111111122233344445556667788
    1234REOFFICEMIKE

    Currently, I run this query and I get the output as below

    SELECT *.

    AGENTS HAS

    LEFT OUTER JOIN AGENT_PHONE AP

    ON A.AGENT_ID = AP. AGENT_ID

    AND A.AGENT_TYPE_CODE = AGENT_TYPE_CODE.

    AND A.AGENT_TYPE_PREFIX = AGENT_TYPE_PREFIX.

    AGENT_IDAGENT_TYPE_CODEAGENT_TYPE_PREFIXNAMEAGENT_IDAGENT_TYPE_CODEAGENT_TYPE_PREFIXPHONE_NUMBERPHONE_TYPE_CODE
    129709REOFFICEROB29709REOFFICE4805551436CELL
    229709REOFFICEROB29709REOFFICE1111111111PHONE
    329709REOFFICEROB29709REOFFICE2223334444OFF
    429709REOFFICEROB29709REOFFICE5556667788FAX
    51234REOFFICEMIKE

    I want id 29709 agent in a line with 1234 agent also id to display

    You can rotate your phone number of agent in columns

    Select *.

    of AGENT_PHONE

    pivot)

    min (PHONE_NUMBER)

    for PHONE_TYPE_CODE in ('CELL' as a 'CELL', 'PHONE' like 'PHONE', 'OFF' in the 'OFF', 'FAX' as 'FAX')

    )

    AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX
    29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788

    Then you can join to view inline or CTE

    with AGENT_PHONE_PIVOT like)

    Select *.

    of AGENT_PHONE

    pivot)

    min (PHONE_NUMBER)

    for PHONE_TYPE_CODE in ('CELL' as a 'CELL', 'PHONE' like 'PHONE', 'OFF' in the 'OFF', 'FAX' as 'FAX')

    )

    )

    SELECT *.

    AGENTS HAS

    LEFT OUTER JOIN AGENT_PHONE_PIVOT AP

    ON A.AGENT_ID = AP. AGENT_ID

    AND A.AGENT_TYPE_CODE = AGENT_TYPE_CODE.

    AND A.AGENT_TYPE_PREFIX = AGENT_TYPE_PREFIX.

    AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX
    29709 RE OFFICE ROB 29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788
    1234 RE OFFICE MIKE - - - - - - -

    Is that what you're looking for?

  • Valid time intervals: two tables intersect documents

    Benefits:

    I have two tables:

    AVAILABILITY (ALLOCATION A_ID, START_TIME, END_TIME, ID_RESSOURCE)

    TASK (T_ID, START_TIME, END_TIME, ID_RESSOURCE)

    My final request should print:

    Id_ressource, DAY_OF_WEEK, MYDATE, DURATION (in hours)

    Semantics back: "give me all the time slots available; Time slot available to the general public is the time range that does not contain a task"

    1. in the tables above START_TIME, END_TIME are of type DATE and they contain a timestamp that is to say:

    SELECT to_char (START_TIME, 'HH24 MMDDYYYY') from the AVAILABILITY/TASK

    would print something like

    09232014 14:17

    2. in the tables above time START_TIME and END_TIME are of the same date and END_TIME > START_TIME IE

    START_TIME = 09232014 14:17

    END_TIME = 09232014 15:17

    no need to check that

    3. If for some date there are TASK BOTH records and AVAILABILITY, then it must be:

    TASK. End_time < = AVAILABILITY. End_time and TASK. Start_time = > AVAILABILITY. START_TIME

    In other words, JOB registration is still "inside" free and BUSY folder

    I need time slots which are essentially output

    -All available records that do not contain a ' ' tasks.

    AVAILABILITY. Id_ressource, to_char (AVAILABILITY. Start_time, 'DAY') as DAY_OF_WEEK, AVAILABILITY. Start_time as MYDATE, (AVAILABILITY. END_TIME-AVAILABILITY. Start_time) * 24 as DURATION

    AND

    -If the free and busy folder contains task (see 3) then there are 2 two time intervals resulting (Yes the duration can be 0)

    AVAILABILITY. Id_ressource, to_char (AVAILABILITY. Start_time, 'DAY') as DAY_OF_WEEK, AVAILABILITY. Start_time as MYDATE, (TASK. START_TIME-AVAILABILITY. Start_time) * 24 as DURATION

    and

    AVAILABILITY. Id_ressource, to_char (AVAILABILITY. Start_time, 'DAY') as DAY_OF_WEEK, AVAILABILITY. Start_time as MYDATE, (AVAILABILITY. END_TIME-TASK. End_time) * 24 as DURATION

    Hope the above makes sense. What is the best, more rapid SQL?

    Hello

    Here's a way to do it:

    WITH union_data AS

    (

    SELECT id_ressource, change_time, change_val

    AVAILABILITY

    UNPIVOT (change_time

    FOR change_val IN (start_time AS 1

    end_time AS - 1

    )

    )

    UNION ALL

    SELECT id_ressource, change_time, change_val

    TASK

    UNPIVOT (change_time

    FOR change_val IN (start_time AS 1

    end_time AS - 1

    )

    )

    )

    got_change_sum AS

    (

    SELECT id_ressource

    change_time

    SUM (change_val) OVER (PARTITION BY id_ressource

    ORDER BY change_time

    ) AS change_sum

    Advance (change_time) OVER (PARTITION BY id_ressource

    ORDER BY change_time

    ) - change_time AS long

    Of union_data

    )

    SELECT id_ressource

    , TO_CHAR (change_time, 'fmDay, FMMM-DD-YYYY') AS available_date

    Duration * 24 AS available_hours

    OF got_change_sum

    WHERE change_sum = 1

    ORDER BY id_ressource

    change_time

    ;

    To see how it works, view the results of each auxiliary request individually.

    You will see that the union_data product has all the points where either avaialablity or a task changes.  The column change_val is + 1 availability or a task at the beginning and - 1, when it ends.  When the cumulative sum of those is 0, this means that there is no availability.  When the accumulated amount is > 1, this means a task is underway.  We are interested in the places where the cumulative sum of change_val is exactly 1, sense that a period which started (but not yet completed) and that there is a net 0 current tasks.

    This solution is NOT the value of start_time and end_time in the same day of calendar and tasks for the same resource may overlap.

  • sqlloader to load two tables of the single data file in a single operation

    Oracle 11.2.0.3 SE - One

    Oracle Linux 5.6

    I don't know if I need a second set of eyes or if I am missing something.

    Problem: Given a file of text csv with header and detail records (identified by the first field in the file) use sql loader to load the header and detail of the tables in a single operation.

    The header record is to take, but the detail records are rejected by omitting the WHEN clause.

    More comments after reading through the exhibits:

    In view of these two tables:

    SQL > desc EDSTEST_HEADER

    Name                                      Null?    Type

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

    EDSTEST_HEADER_ID NOT NULL NUMBER

    REC_TYPE VARCHAR2 (10)

    SOLD_TO_ACCOUNT VARCHAR2 (50)

    SCAC_RECEIVER_ID VARCHAR2 (50)

    FORMAT_TYPE VARCHAR2 (10)

    CLIENT_NAME VARCHAR2 (100)

    CUSTOMER_PICKUP_ADDRESS VARCHAR2 (100)

    CUSTOMER_PICKUP_CITY VARCHAR2 (50)

    CUSTOMER_PICKUP_STATE VARCHAR2 (10)

    CUSTOMER_PICKUP_ZIP VARCHAR2 (50)

    INSERT_USER VARCHAR2 (50)

    DATE OF INSERT_USER_DATE

    INSERT_STATUS_CODE VARCHAR2 (10)

    SQL > desc EDSTEST_DETAIL

    Name Null?    Type

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

    EDSTEST_DETAIL_ID NOT NULL NUMBER

    NUMBER OF EDSTEST_HEADER_ID

    REC_TYPE VARCHAR2 (10)

    SHIP_TO_NAME VARCHAR2 (100)

    SHIP_TO_ADDRESS VARCHAR2 (100)

    SHIP_TO_CITY VARCHAR2 (50)

    SHIP_TO_STATE VARCHAR2 (10)

    SHIP_TO_ZIP VARCHAR2 (50)

    STATUS_OR_APPT_REASON_CD VARCHAR2 (10)

    EVENT_DESCRIPTION VARCHAR2 (50)

    SHIPMENT_STATUS_CD VARCHAR2 (10)

    SHIPMENT_EVENT_DATE VARCHAR2 (10)

    SHIPMENT_EVENT_TIME VARCHAR2 (10)

    EVENT_TIME_ZONE VARCHAR2 (30)

    EVENT_CITY VARCHAR2 (100)

    EVENT_STATE VARCHAR2 (50)

    EVENT_ZIP VARCHAR2 (50)

    CUSTOMER_CONFIRM VARCHAR2 (100)

    DELIVERY_CONFIRM VARCHAR2 (100)

    TRACKING_NUMBER VARCHAR2 (50)

    MAIL_REC_WEIGHT VARCHAR2 (20)

    MAIL_REC_WEIGHT_CD VARCHAR2 (10)

    MAIL_RED_QTY VARCHAR2 (10)

    INSERT_USER VARCHAR2 (50)

    DATE OF INSERT_USER_DATE

    INSERT_STATUS_CODE VARCHAR2 (10)

    In light of this data file:

    Oracle: mydb$ cat eds_edstest.dat

    HDR, 0005114090, MYORG, CSV, MY NAME OF THE COMPANY, 123 ELM ST, STUCKYVILLE, OH, 12345

    DTL, TOADSUCK, NC, 27999, NS, ARRIVED at the UNIT, X 4, 20140726, 063100, AND, TOADSUCK, NC,.3861, 27999, 12345, 23456 lbs, 1

    DTL, TOADSUCK, NC, 27999, lbs, 1 NS, SORTING COMPLETE, X 6, 20140726, 080000, AND TOADSUCK, NC,.3861, 27999, 12345, 23456

    DTL, TOADSUCK, NC, 27999, NS, PRONOUNCED, D1, 20140726, 121800, TOADSUCK, NC, 27999, 12345, 23456,.3861, lbs and 1

    Given this control sqlloader file:

    Oracle: mydb$ cat eds_edstest_combined.ctl

    Load

    INFILE ' / xfers/oracle/myapp/data/eds_edstest.dat'

    BADFILE ' / xfers/oracle/myapp/data/eds_edstest.bad'

    DISCARDFILE ' / xfers/oracle/myapp/data/eds_edstest.dsc'

    ADD

    IN THE TABLE estevens.edstest_header

    WHERE (rec_type = 'HDR')

    FIELDS TERMINATED BY ', '.

    SURROUNDED OF POSSIBLY "" "

    TRAILING NULLCOLS

    (rec_type CHAR,

    sold_to_account TANK,

    scac_receiver_id TANK,

    format_type TANK,

    client_name TANK,

    customer_pickup_address TANK,

    customer_pickup_city TANK,

    customer_pickup_state TANK,

    customer_pickup_zip TANK,

    INSERT_USER "1"

    INSERT_USER_DATE sysdate,

    INSERT_STATUS_CODE CONSTANT 'I')

    IN THE TABLE estevens.edstest_detail

    WHERE (rec_type = 'PIF')

    FIELDS TERMINATED BY ', '.

    SURROUNDED OF POSSIBLY "" "

    TRAILING NULLCOLS

    (rec_type CHAR,

    ship_to_name TANK,

    ship_to_address TANK,

    ship_to_city TANK,

    ship_to_state TANK,

    ship_to_zip TANK,

    status_or_appt_reason_cd TANK,

    event_description TANK,

    shipment_status_cd TANK,

    shipment_event_date TANK,

    shipment_event_time TANK,

    event_time_zone TANK,

    event_city TANK,

    Event_State TANK,

    event_zip TANK,

    customer_confirm TANK,

    delivery_confirm TANK,

    tracking_number TANK,

    mail_rec_weight TANK,

    mail_rec_weight_cd TANK,

    mail_red_qty TANK,

    INSERT_USER "1"

    INSERT_USER_DATE sysdate,

    INSERT_STATUS_CODE CONSTANT 'I')

    -END CONTROL FILE

    And the time of execution of transactions:

    SQL * Loader: release 11.2.0.3.0 - Production the kill Jul 29 07:50:04 2014

    Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

    Control file: /xfers/oracle/myapp/control/eds_edstest_combined.ctl

    Data file: /xfers/oracle/myapp/data/eds_edstest.dat

    Bad leadership: /xfers/oracle/myapp/data/eds_edstest.bad

    Delete the file: /xfers/oracle/myapp/data/eds_edstest.dsc

    (Allow all releases)

    Number of loading: ALL

    Number of jump: 0

    Authorized errors: 50

    Link table: 10000 lines, maximum of 256000 bytes

    Continuation of the debate: none is specified

    Path used: classics

    Silent options: your COMMENTS

    Table ESTEVENS. EDSTEST_HEADER, loaded when REC_TYPE = 0 X 484452 (character "HDR") add the option in effect for this table: APPEND TRAILING NULLCOLS option in effect

    Column Position Len term Encl. Datatype name

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

    FIRST REC_TYPE *, O ("") CHARACTER

    SOLD_TO_ACCOUNT NEXT *, O ("") CHARACTER

    SCAC_RECEIVER_ID NEXT *, O ("") CHARACTER

    FORMAT_TYPE NEXT *, O ("") CHARACTER

    CLIENT_NAME NEXT *, O ("") CHARACTER

    CUSTOMER_PICKUP_ADDRESS NEXT *, O ("") CHARACTER

    CUSTOMER_PICKUP_CITY NEXT *, O ("") CHARACTER

    CUSTOMER_PICKUP_STATE NEXT *, O ("") CHARACTER

    CUSTOMER_PICKUP_ZIP NEXT *, O ("") CHARACTER

    INSERT_USER NEXT *, O ("") CHARACTER

    The SQL string for the column: "1."

    INSERT_USER_DATE SYSDATE

    CONSTANT INSERT_STATUS_CODE

    The value is 'I '.

    Table ESTEVENS. EDSTEST_DETAIL, loaded when REC_TYPE = 0X44544c ('PIF' character) in effect for this table insert option: APPEND TRAILING NULLCOLS option in effect

    Column Position Len term Encl. Datatype name

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

    REC_TYPE NEXT *, O ("") CHARACTER

    SHIP_TO_NAME NEXT *, O ("") CHARACTER

    SHIP_TO_ADDRESS NEXT *, O ("") CHARACTER

    SHIP_TO_CITY NEXT *, O ("") CHARACTER

    SHIP_TO_STATE NEXT *, O ("") CHARACTER

    SHIP_TO_ZIP NEXT *, O ("") CHARACTER

    STATUS_OR_APPT_REASON_CD NEXT *, O ("") CHARACTER

    EVENT_DESCRIPTION NEXT *, O ("") CHARACTER

    SHIPMENT_STATUS_CD NEXT *, O ("") CHARACTER

    SHIPMENT_EVENT_DATE NEXT *, O ("") CHARACTER

    SHIPMENT_EVENT_TIME NEXT *, O ("") CHARACTER

    EVENT_TIME_ZONE NEXT *, O ("") CHARACTER

    EVENT_CITY NEXT *, O ("") CHARACTER

    EVENT_STATE NEXT *, O ("") CHARACTER

    EVENT_ZIP NEXT *, O ("") CHARACTER

    CUSTOMER_CONFIRM NEXT *, O ("") CHARACTER

    DELIVERY_CONFIRM NEXT *, O ("") CHARACTER

    TRACKING_NUMBER NEXT *, O ("") CHARACTER

    MAIL_REC_WEIGHT NEXT *, O ("") CHARACTER

    MAIL_REC_WEIGHT_CD NEXT *, O ("") CHARACTER

    MAIL_RED_QTY NEXT *, O ("") CHARACTER

    INSERT_USER NEXT *, O ("") CHARACTER

    The SQL string for the column: "1."

    INSERT_USER_DATE SYSDATE

    CONSTANT INSERT_STATUS_CODE

    The value is 'I '.

    value used for the parameter LINES increased from 10000 to 30 sheet 2: discarded - failed all WHEN clauses.

    Sheet 3: Discarded - failed all WHEN clauses.

    Folder 4: Discarded - failed all WHEN clauses.

    Table ESTEVENS. EDSTEST_HEADER:

    1 row loaded successfully.

    0 rows not loaded due to data errors.

    3 rows not loading because all WHEN clauses were failed.

    0 rows not populated because all fields are null.

    Table ESTEVENS. EDSTEST_DETAIL:

    0 rows successfully loaded.

    0 rows not loaded due to data errors.

    4 rows not loading because all WHEN clauses were failed.

    0 rows not populated because all fields are null.

    The space allocated to bind table: 247800 byte (30 lines)

    Bytes of read buffer: 1048576

    Total logical records ignored: 0

    Total logical records read: 4

    Total rejected logical records: 0

    Logical records discarded total: 3

    Run started the kill Jul 29 07:50:04 2014

    Run finished on Tue Jul 29 07:50:04 2014

    Time was: 00:00:00.07

    Time processor was: 00:00:00.01

    It works on linux, and the file data calculated from a Windows system to the time we get to it, but it's in the * nix format - with a simple x '0A' as the line terminator.

    If, in the control file, I comment on the block of INSERTION for the header table, retail inserts very well.

    If, in the control file, (return to the initial charge, two tables) I change the line

    INFILE ' / xfers/oracle/myapp/data/eds_edstest.dat'

    To read

    INFILE ' / xfers/oracle/myapp/data/eds_edstest.dat' "str" | "» \n' »

    The saved result becomes

    Table ESTEVENS. EDSTEST_HEADER:

    1 row loaded successfully.

    0 rows not loaded due to data errors.

    0 rows not loading because all WHEN clauses were failed.

    0 rows not populated because all fields are null.

    Table ESTEVENS. EDSTEST_DETAIL:

    0 rows successfully loaded.

    0 rows not loaded due to data errors.

    1 row not loaded because all WHEN clauses were failed.

    0 rows not populated because all fields are null.

    I try to help the developer on this, and it resists change to use external tables. Even if I can overcome that, I now have a puzzle I want to solve, just to add to my knowledge.  Plus, I have some concerns at this stage that whatever it is that miss me here could also come into play if I convert external tables.

    Ed,

    Are you sure that put you the post in the right place?  It should be located in the first definition of the following field each time after the first when clause clause.  Put after the first when the clause is optional.  When I use the following with what you have provided, it loads 1 record in the table header and 3 records in the Details table.  Did you actually do or tell your developer to do and wish that he understood and put it in the right place?

    Load

    INFILE 'eds_edstest.dat '.

    BADFILE "eds_edstest.bad."

    DISCARDFILE 'eds_edstest.dsc '.

    ADD

    IN THE TABLE edstest_header

    WHERE (rec_type = 'HDR')

    FIELDS TERMINATED BY ', '.

    SURROUNDED OF POSSIBLY "" "

    TRAILING NULLCOLS

    (rec_type CHAR,

    sold_to_account TANK,

    scac_receiver_id TANK,

    format_type TANK,

    client_name TANK,

    customer_pickup_address TANK,

    customer_pickup_city TANK,

    customer_pickup_state TANK,

    customer_pickup_zip TANK,

    INSERT_USER "1"

    INSERT_USER_DATE sysdate,

    INSERT_STATUS_CODE CONSTANT 'I')

    IN THE TABLE edstest_detail

    WHERE (rec_type = 'PIF')

    FIELDS TERMINATED BY ', '.

    SURROUNDED OF POSSIBLY "" "

    TRAILING NULLCOLS

    (rec_type POSITION (1) TANK,

    ship_to_name TANK,

    ship_to_address TANK,

    ship_to_city TANK,

    ship_to_state TANK,

    ship_to_zip TANK,

    status_or_appt_reason_cd TANK,

    event_description TANK,

    shipment_status_cd TANK,

    shipment_event_date TANK,

    shipment_event_time TANK,

    event_time_zone TANK,

    event_city TANK,

    Event_State TANK,

    event_zip TANK,

    customer_confirm TANK,

    delivery_confirm TANK,

    tracking_number TANK,

    mail_rec_weight TANK,

    mail_rec_weight_cd TANK,

    mail_red_qty TANK,

    INSERT_USER "1"

    INSERT_USER_DATE sysdate,

    INSERT_STATUS_CODE CONSTANT 'I')

  • Merge two schemas

    Hello

    Oracle11.2.0.1.0 < /p >

    RHEL5

    I landed in a situation where I have to merge two schemas in different databases.

    Schema name is the same, the Table names are also same on two patterns

    The only difference that could be in the diagrams is the data within these tables.

    What we want is that when importing data into a table, if the primary key already exists in the target table, then it should update the primary key of the table source with the max value + target 1 of the primary key for the table.

    Also tables would be having a lot of constraints attached to them.

    So, here I just wanted to have little guidance on the scenario of the gurus of the oracle

    I landed in a situation where I have to merge two schemas in different databases.

    Schema name is the same, the Table names are also same on two patterns

    The only difference that could be in the diagrams is the data within these tables.

    What we want is that when importing data into a table, if the primary key already exists in the target table, then it should update the primary key of the table source with the max value + target 1 of the primary key for the table.

    Also tables would be having a lot of constraints attached to them.

    So, here I just wanted to have little guidance on the scenario of the gurus of the oracle

    Even though I think I understand what you're SAYING you want to do I am not at all convinced that you should actually do.

    The integrity of the data - you will simply ignore this aspect of the problem?

    This guarantees that the lines corresponding to a key value of substitution even remotely represent the same real data set. For example, a customer table may use a sequence to a surrogate key, but a key value of 23 in a pattern table can be a totally different person from the person with the key value of 23 in the other schema.

    Further - even if the same person IS represented, the other columns/attributes can be different. Someone may have changed of name, address, telephone or any other piece of data. So now you would just be throwing the source line because it has the same substitution as a line existing target key.

    Frankly I do not know any business user I've ever worked with who would take that kind of risk.

    Even to do what you say you want, you do it in an operation of "import". You load data into a work table, and then retrieve data that do not have an existing key value in the target table.

    My recommendation is that you, or someone, to prepare a detailed functional requirements document that addresses ALL potential problems with data integrity that might arise and explains how business users want to treat.

    If you do that you are virtually guaranteed to corrupt your data. In addition to corruption will be such that it will be very difficult to know what was the source of any particular data item.

  • Main table with two tables of children as part of the ADF

    Hello

    I'm trying to implement single master with two tables in detail using oracle adf framework of Jdev 11.1.1.4.0. I am able to only master / details using the link display but unable to reach the details i.e., nested block child master with nested blocks.

    I created query view object based on the master and two poll objects of the base seen as details. Then, I created two master of first child link and another link for master of the second child. Even in this case in my data controls I see two different components which is incorrect.

    Please let me know how to create a data control for an example below:
    Fruit [MASTER]
    -Details of Fruits such as the table of the adf
    -Apples [FIRST CHILD]
    -Details of the apples as adf table
    -Orange [SECOND CHILD]
    -Details of the Oranges as adf table

    Kind regards
    Amar.

    You need two viewLinks
    Fruit-> apples
    Fruit-> Oranges

    Then, in the data model, you choose the entry of fruit that has:
    Fruit
    |---> Apples

    You stand on the fruit and you shuttle Oranges to be below left to right.

    If you use the HR schema by default, you will see this type of relationship for employees:
    https://blogs.Oracle.com/Shay/entry/master_with_two_details_on_the

Maybe you are looking for

  • Mailing address: cannot send mail via VPN

    I use OS X 10.11.3 El Capitan and Mail 9.2 Whenever the computer is connected via the PIA VPN, Mail cannot send e-mail messages.  Is there a work around for this problem?  Please, let me know.  Thank you!

  • HP Compaq Elite 8300 CMT: updated graphics card for HP Compaq Elite 8300 CMT

    Currently, I have HP Compaq Elite 8300 CMT Business PC with ATI Radeon HD 7450 graphics card. This map, however, does not seem to be compatible with the new CC in Photoshop. I want to update the graphics card. Supported for this PC graphics cards lik

  • WUSB600N v2 drivers for Windows 7 64 bit?

    Hello My mother has recently bought a desktop Dell Inspiron 546 new with Windows 7 64 bit computer.  I can't the computer to install the drivers on the cd or the ones I downloaded and installed.  Is available here one that works?  Thank you.

  • Not connected, you are currently not connected to any network.

    When I'm on the network icon or click on it says "not connected, you are currently not connected to any networks." I know I'm connected but how am I guess sharing media with friends now, it's kind of a big deal for me and I tried to remove the networ

  • Sudden issue with eprint &amp; allowing any application or web services

    Hi all I have a case with HP and spent 4 + hours on the phone with support eprint people and people of departmental support. Unfortunately, they are now gone for the weekend, and I'm still stuck here with a defective system - and have to leave this w