Lgical table from two physical table

Hi,
I am trying to design a logical fact table from two physical table. One table has transaction data and another has accounting data. The requirement is, I need to merge the rows between these two tables, where were it matches. If the keys are not matching between these two table then also I need to bring those rows from both tables as separate rows. How can i do this? Also can i have a logical table as source for my fact table.

You'll need outer joins in your physical layer and you can drag the columns from both physical tables to a single logical table and you will see in the BMM layer it will create the two logical table sources.

Similar Messages

  • Table transformation from two different database

    Hi all,
    I am trying to load table from one database table to another database table in ODI 10g.I have created two physical and logical topology.
    But when in interface design i have drag the source and target tables in the diagram window, but here it doesnot shows the auto mapping options, when i try it manually by dragging a field, i have failed. when i execute the operation the following error occured:
    create or replace view db1."C$_0 W_INT_ORG_D"
    as select     
    from     db1.W_INT_ORG_DS W_INT_ORG_DS
    where     (1=1)
    here both the source and target db are same..
    How can i resolve it

    Hi,
    Thanks it worked.
    I am getting another error on Insert flow into I$ table step.
    I am connecting two database from two different hosts, both are in oracle.
    I have two logical schema prepared for both database.
    should i have to mentioned these schema in one physical topology? what should be placed in schema and work schema option.
    I have used LKM Oracle to Oracle(DBLINK) as KM.
    Please help
    Best regards,
    manish

  • OBIEE 11g - Combine data from two Oracle tables

    Good day!
    I tried to combine data from two Oracle tables as fact data, but it doesn't work.
    My steps: I created SCOTT.EMP2 table from SCOTT.EMP table, update EMPNO and ENAME values of EMP2 table to distinguish data of my tables. Then I imported physical tables DEPT, EMP and EMP2 to BIEE 11g, created joins DEPT-EMP and DEPT-EMP2 in physical diagram. Then I dragged DEPT and EMP tables to BMM, and EMP2 table to EMP as second LTS. In Content tab for EMP and EMP2 I checked "This source should be combined with other sources at this level" checkboxes. Then I renamed logical tables EMP and DEPT to Employees and Departments and dragged them to Presentation area. In Answers I created Analysis with columns DNAME and ENAME.
    The problem is that data on results tab is only from one physical table EMP or EMP2 (depending on the order of sources EMP and EMP2 of LT Employees) and not from both.
    Can anybody help? Am I missed something?
    Al.

    Hi Al,
    I think you have to define the content of the LTS.
    http://download.oracle.com/docs/cd/E12096_01/books/admintool/admintool_BusModSetup16.html
    You have to specify the content of the different fragments.
    http://download.oracle.com/docs/cd/E12096_01/books/admintool/admintool_SetUpAggNav3.html#wp1005333
    Maybe you have to add an additional column 'Source' ('EMP1', 'EMP2')
    Good Luck,
    Daan Bakboord
    http://obibb.wordpress.com

  • From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    From two given tables, how do you fetch the values from two columns using values from one column(get values from col.A if col.A is not null and get values from col.B if col.A is null)?

    Hi,
    Use NVL or COALESCE:
    NVL (col_a, col_b)
    Returns col_a if col_a is not NULL; otherwise, it returns col_b.
    Col_a and col_b must have similar (if not identical) datatypes; for example, if col_a is a DATE, then col_b can be another DATE or it can be a TIMESTAMP, but it can't be a VARCHAR2.
    For more about NVL and COALESCE, see the SQL Language manual: http://docs.oracle.com/cd/E11882_01/server.112/e26088/functions119.htm#sthref1310
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • How to create a foreign key for the table from two different tables?

    Hi All,
    I have a three table like below. In the below table SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK will be having the primary key for NAME column. The same SAMPLE_CONS3_CHECK table also having the primary key for NAME column and forieign key for SAMPLE_CONS_CHECK and SAMPLE_CONS2_CHECK tables. See the below code 2
    code 1:
    CREATE TABLE SAMPLE_CONS_CHECK
            (NAME VARCHAR2(10),
            SERIES  VARCHAR2(5)
    CREATE TABLE SAMPLE_CONS2_CHECK
            (NAME  VARCHAR2(5),
             MODEL  NUMBER
    CREATE TABLE SAMPLE_CONS3_CHECK
            (NAME  VARCHAR2(5),
             MODEL_NO  NUMBER
            )code 2
    alter table SAMPLE_CONS_CHECK
    add constraint SAMPLE_CONS_CHECK_pk primary key (NAME)
    alter table SAMPLE_CONS2_CHECK
    add constraint SAMPLE_CONS2_CHECK_pk primary key (NAME)
    alter table SAMPLE_CONS3_CHECK
    add constraint SAMPLE_CONS3_CHECK_pk primary key (NAME)
    ALTER TABLE SAMPLE_CONS3_CHECK ADD
    CONSTRAINT SAMPLE_CONS3_CHECK_FK1 FOREIGN KEY
         NAME
    ) REFERENCES SAMPLE_CONS_CHECK
        NAME
    ) ON DELETE CASCADE;
    ALTER TABLE SAMPLE_CONS3_CHECK ADD
    CONSTRAINT SAMPLE_CONS3_CHECK_FK2 FOREIGN KEY
         NAME
    ) REFERENCES SAMPLE_CONS2_CHECK
        NAME
    ) ON DELETE CASCADE;From the above schenario i am able to insert the data to SAMPLE_CONS3_CHECK table. But the parent data is already available in the parent table. The problem is here two different constarints from two different tables. While inserting, it is checking from both the tables whether the parent is exist or not.
    How can i solve this problem? Can anyone halp me about this?
    Thanks
    Edited by: orasuriya on Aug 8, 2009 2:02 AM

    Actually the design is completely incorrect.
    What you say is
    I have
    'foo', 'foo series'
    'foo','foo model'
    'foo',666
    By virtue of table3 referring to both table1 and table2.
    This means you actually need to have 1 (one) table:
    'foo','foo series','foo model', 666
    And the 'problem' disappears.
    Sybrand Bakker
    Senior Oracle DBA

  • Data from two tables in the same row in XML transformation

    Hi,
        I am using XML transformation for generating excel file which is to besent as email attachment.
        Here  I want to display the data from two internal tables in the same row in the excel. .I am using   <tt:loop ref=".<table name>"> ...  </tt:loop> for looping through the table. Can I loop two table simultaneously ? In that case how will I specify the fields in each table . Some of the fields in two tables are of same name and type.
    Please help...
    Thanks,
    Jissa

    Hello Brian,
    Thank you for your answer. It is approach I will use, I think. However let me ask: Would it be possible to have a Version in this layout, too? I mean to see, which value comes from Version A and which comes from Version B? Something like this:
    Calendar Month Version Sales Amount
    2011.01  B  200
    2011.02  B  300
    2011.03  A  260
    2011.04  A  230
    2011.05  A  200
    A

  • To Select the data from two table one is transp table and onther is cluster

    Hi All,
    I want to select the data from two tables
    Here i am giving with an example.
    Fileds: kunnr belnr from bseg.  table bseg
    fields: adrnr from kna1     table: kna1.
    Know i want to put these into one internal table based on kunnr and belnr.
    Thanks in advance.
    Ramesh

    Hi,
       U cant use joins on cluster table and BSEG is a cluster table so use FOR  ALL ENTRIES for taht
    refer this code
    *&      Form  sub_read_bsak
          text
    -->  p1        text
    <--  p2        text
    FORM sub_read_bsak.
    *--Select data from BSAK Table
      SELECT lifnr
             augdt
             augbl
             gjahr
             belnr
             xblnr
             blart
             dmbtr
             mwskz
             mwsts
             sgtxt
             FROM bsak
             INTO CORRESPONDING FIELDS OF TABLE it_bsak
             WHERE belnr IN s_belnr
             AND   augdt IN s_augdt.
      IF sy-subrc EQ 0.
    *--Sort table by accounting document and vendor number
        SORT it_bsak BY belnr lifnr.
      ENDIF.
    ENDFORM.                    " sub_read_bsak
    *&      Form  sub_read_bseg
          text
    -->  p1        text
    <--  p2        text
    FORM sub_read_bseg.
      IF NOT it_bsak[] IS INITIAL.
    *--Select data from BSEG table
        SELECT belnr
               gjahr
               shkzg
               kostl
               hkont
               ebeln
               ebelp
               FROM bseg
               INTO CORRESPONDING FIELDS OF TABLE it_bseg
               FOR ALL ENTRIES IN it_bsak
               WHERE belnr EQ it_bsak-belnr
               AND   gjahr EQ it_bsak-gjahr
               AND   shkzg EQ 'S'.
        IF sy-subrc EQ 0.
    *--Sort table by accounting document
          SORT it_bseg BY belnr.
        ENDIF.
      ENDIF.
    ENDFORM.                    " sub_read_bseg

  • Need of SQL query in selecting distinct values from two tables

    hi,
    I need a query for selecting distinct values from two tables with one condition.
    for eg:
    there are two tables a & b.
    in table a there are values like age,sex,name,empno and in table b valuses are such as age,salary,DOJ,empno.
    here what i need is with the help of empno as unique field,i need to select distinct values from two tables (ie) except age.
    can anybody please help me.
    Thanks in advance,
    Ratheesh

    Not sure what you mean either, but perhaps this will start a dialog:
    SELECT DISTINCT a.empno,
                    a.name,
                    a.sex,
                    b.salary,
                    b.doj
    FROM    a,
            b
    WHERE   a.empno = b.empno;Greg

  • Data from two fact tables??

    I have a report in which I am comparing two fact tables at month level. I have columns calculated at this level.
    One fact has all month entries and other does not have all.
    I need to show all the month values and measures in the report even if some months donot exist in one fact and exists in the other.
    Currently, my report shows only those months which two facts have in common.
    Please suggest.

    Left join didnot work for me..Still getting the same result.
    I created two identical reports from two identical facts.... using "combine with similar request"
    Dummied columns from 2nd fact (placed 0s) for 1st report
    and dummied columns from 1st fact (placed 0s) for 2nd report.
    In the fnal report..
    I am getting two rows for each month..
    I need to club those two rows into single row by summing up the values..is that possible?
    January ..................10 .........0
    January...................0............15
    February..................3.............0
    February ..................0...........-1
    I need the out put as..
    January.....................10............15
    February.....................3............-1

  • Select from two tables and insert into a third

    I'm trying to do a select from two tables and do an insert into a third table from the two resulting columns.
    I have the following....
    DECLARE
    tempsid number;
    temphostid number;
    BEGIN
    select "DBSID_ID","ID" into tempsid,temphostid from "DBSIDS","SERVERS"
    where "HOST_SID" like '%'||"DBSID_NAME"||'%'
    and "HOST_NAME" not like 'vio%'
    and exists (select "DBSID_NAME" from DBSIDS)
    order by "DBSID_NAME";
    insert into "DBSID_LOOKUP" ("SIDLOOKUP_ID", "SERVERLOOKUP_ID")
    values(tempsid, temphostsid);
    END;
    run;
    I get the error ....
    ORA-06550: line 11, column 18:
    PL/SQL: ORA-00984: column not allowed here
    ORA-06550: line 10, column 1:
    PL/SQL: SQL Statement ignored
    1. DECLARE
    2. tempsid number;
    3. temphostid number;

    okay ... I tried a different way ...
    DECLARE
    a number;
    b number;
    BEGIN
    select "DBSID_ID","ID" into a,b from "DBSIDS","SERVERS"
    where "HOST_SID" like '%'||"DBSID_NAME"||'%'
    and "HOST_NAME" not like 'vio%'
    and exists (select "DBSID_NAME" from DBSIDS)
    order by "DBSID_NAME";
    insert into "DBSID_LOOKUP" (SIDLOOKUP_ID, SERVERLOOKUP_ID) values (a, b);
    END;
    and now it whines about ...
    ORA-01422: exact fetch returns more than requested number of rows

  • Problem reading data from two tables

    Hi experts,
    I'm developing a JDBC - IDOC scenario that needs to read data from two oracle tables. I have created a BPM that has a initial fork for the two channels and it works fine.
    The problem is that I need to read data from the first, two or both tables depending if there is data to read. If there is data in the two tables it works, but if only there is data in one of the two tables, I have read problems. I have tryed to set the 'neccesary branches' to 1 but this is a problem when I have data in both tables.
    Any idea?
    Best Regards,
    Alfredo Lagunar.

    Hi,
    have your fork step inside a block and then right-click your block to insert a deadline branch to your BPM process and specify the time after which your BPM process should be cancelled.....so if in that time, you get data from both tables, your BPM will work okay otherwise if that time is over, then your BPM process will be cancelled.
    Regards,
    Rajeev Gupta

  • Cartesian of data from two tables with no matching columns

    Hello,
    I was wondering – what’s the best way to create a Cartesian of data from two tables with no matching columns in such a way, so that there will be only a single SQL query generated?
    I am thinking about something like:
    for $COUNTRY in ns0: COUNTRY ()
    for $PROD in ns1:PROD()
    return <Results>
         <COUNTRY> {fn:data($COUNTRY/COUNTRY_NAME)} </COUNTRY>
         <PROD> {fn:data($PROD/PROD_NAME)} </PROD>
    </Results>
    And the expected result is combination of all COUNTRY_NAMEs with all PROD_NAMEs.
    What I’ve noticed when checking query plan is that DSP will execute two queries to have the results – one for COUNTRY_NAME and another one for PROD_NAME. Which in general results in not the best performance ;-)
    What I’ve noticed also is that when I add something like:
    where COUNTRY_NAME != PROD_NAME
    everything is ok and there is only one query created (it's red in the Query plan, but still it's ok from my pov). Still it looks to me more like a workaround, not a real best approach. I may be wrong though...
    So the question is – what’s the suggested approach for such queries?
    Thanks,
    Leszek
    Edited by xnts at 11/19/2007 10:54 AM

    Which in general results in not the best performanceI disagree. Only for two tables with very few rows, would a single sql statement give better performance.
    Suppose there are 10,000 rows in each table - the cross-product will result in 100 million rows. Sounds like a bad idea. For this reason, DSP will not push a cross-product to a database. It will get the rows from each table in separate sql statements (retrieving only 20,000 rows) and then produce the cross-product itself.
    If you want to execute sql with cross-products, you can create a sql-statement based dataservice. I recommend against doing so.

  • Select data from two tables...!

    HI Experts...!
    i m a beginner user and i want to select data from two tables proj and prps.....using joins.....and internal tables i have written a code...
    SELECT prps~pspnr
           prps~objnr
           prps~psphi
           proj~ernam
           proj~erdat
           proj~pspnr
    INTO  table itab   -
    itab is internal table
    FROM prps inner join proj
    WHERE pspnr in p_no and prpspsphi = projpspnr.
    but there is error in from clause ..please help me....
    Advance thanx....

    Hi,
    check the sample code bellow above two reply will solve out your problem but one more extra line in your code pointed out bellow.
    TABLES: prps, proj.
    TYPES:  BEGIN OF ty_test,
            pspnr LIKE prps-pspnr,
            objnr LIKE prps-objnr,
            psphi LIKE prps-psphi,
            ernam LIKE proj-ernam,
            erdat LIKE proj-erdat,
            END OF ty_test.
    DATA: itab TYPE STANDARD TABLE OF ty_test WITH HEADER LINE.
    SELECT-OPTIONS: p_no FOR prps-pspnr.
    SELECT  prps~pspnr
            prps~objnr
            prps~psphi
            proj~ernam
            proj~erdat
    *        proj~pspnr " No need for this you have selected this in
    *     the first line because it is commone so you only need to select from any one
            INTO TABLE itab
    FROM prps INNER JOIN proj ON ( prps~pspnr = proj~pspnr  )
    WHERE prps~pspnr IN p_no.
    Best Regards,
    Faisal
    Edited by: Rob Burbank on Dec 24, 2009 12:24 PM

  • Dataset from two set of tables based on condition

    I have two queries that will return same columns from two different set of tables ( column mapping has been taken care of). The return type is out ref cursor. (P_SUPPLY_REORDER )
    Query 1-SO
    select
    so.SMO_NO,
    so.SPLY_ORD_DT,
    so.fk_CUST_ID as CUST_ID,
    so.CUST_PO_NO,
    so.ATTENTION_NAME,
    sum(sol.SPLY_ORD_QTY) as SPLY_ORD_QTY,
    --sum(sol.sply_shp_qty),
    so.ST_NAME,
    so.ADDR_LN_2,
    so.ADDR_LN_3,--sta.SHIP_TO_ADDRESS_LINE_3,
    so.CITY_NAME,
    so.ST_TERR_CD,
    so.ZIP_CD,
    so.SPCL_SHP_INSTR_TXT,
    so.SHP_CNFRM_DT
    ,XCOM_ORDER_NO
    from
    supply_order so,
    supply_order_line sol,
    XCOM_ORDER_HEADER
    where
    so.FK_CUST_ID =in_cust_id
    and so.pc_ord_no = sol.fk_pc_ord_no and
    XCOM_ORDER_HEADER.FK_PC_ORD_NO = so.PC_ORD_NO
    group by so.SMO_NO, so.SPLY_ORD_DT, so.fk_CUST_ID,
    so.CUST_PO_NO, so.ATTENTION_NAME,
    so.ST_NAME, so.ADDR_LN_2, so.ADDR_LN_3, so.CITY_NAME, so.ST_TERR_CD,
    so.ZIP_CD, so.SPCL_SHP_INSTR_TXT, so.SHP_CNFRM_DT, XCOM_ORDER_NO;
    Query-2 Xcom
    select
    null as sMO_NO,
    xso.created_date as SPLY_ORD_DT,
    xso.fk_cust_id as cust_id,
    cust.cust_po_no as cust_PO_NO
    ,(sta.SHIP_TO_ATTN_FIRST_NAME||''||sta.SHIP_TO_ATTN_LAST_NAME) as attention_name,
    xsol.CARTONS_ORDERED as SPLY_ORD_QTY,
    --sum(sol.sply_shp_qty),
    sta.SHIP_TO_ADDRESS_LINE_1 as ST_NAME,
    sta.SHIP_TO_ADDRESS_LINE_2 as ADDR_LN_2,
    --sta.SHIP_TO_ADDRESS_LINE_3,
    NULL as ADDR_LN_3,
    sta.ship_to_city as CITY_NAME,
    sta.SHIP_TO_STATE as ST_TERR_CD,
    sta.SHIP_TO_POSTAL_CODE as ZIP_CD,
    sta.SHIPPING_INSTRUCTIONS as SPCL_SHP_INSTR_TXT,
    null  as SHP_CNFRM_DT,
    xso.XCOM_ORDER_NO as XCOM_ORDER_NO
    from
    XCOM_ORDER_HEADER xso,
    XCOM_ORDER_LINES xsol,
    customer cust,
    ship_to_address sta
    where
    cust.cust_id = xso.fk_cust_id and
    sta.fk_cust_id = xso.fk_cust_id
    and xso.FK_CUST_ID =in_cust_id
    and xso.FK_PC_ORD_NO is null
    and xso.xcom_order_no = xsol.fk_xcom_order_no;Now the requirement is
    One of four conditions are possible for each Supply Reorder Number:
    •     Both table queries return no records
    -     Populate all the P_SUPPLY_REORDER output fields with nulls
    •     SUPPLY_ORDER returns a record, but XCOM_ORDER_HEADER returns no records
    -     Populate output fields with values from the join of SUPPLY_ORDER and SUPPLY_ORDER_LINE.
    •     SUPPLY_ORDER returns no records, but XCOM_ORDER_HEADER returns one record
    -     Populate output fields with values from the join of XCOM_ORDER_HEADER and XCOM_ORDER_LINES.
    •     SUPPLY_ORDER returns a record, and XCOM_ORDER_HEADER returns a record; find out the latest order by comapring max(SPLY_ORD_DT)
    from SUPPLY_ORDER with max(CREATED_DATE) from XCOM_ORDER_HEADER.
    -     If the latest order is in SUPPLY_ORDER, then populate output fields with values from the join of SUPPLY_ORDER and SUPPLY_ORDER_LINE.
    -     If order dates are equal from both join results, then populate output fields with values from the join of SUPPLY_ORDER and SUPPLY_ORDER_LINE.
    -     If the latest order is in XCOM_ORDER_HEADER, then populate output fields with values from the join of XCOM_ORDER_HEADER and XCOM_ORDER_LINES.
    Question is how can we switch over the queries to pull respective dataset based on these conditions ( checking that which table join is going to return a row and then based upon latest order if both tables return a row) and all this logic as part of single SQL statement that is returned as OUT Ref Cursor.
    Your help will be really appreciated. Thanks much in advance.

    It would be easier if you would supply a dataset we can work with. And I assume the queries are called within a other cursor which returns in_cust_id right?
    The best/fasters way would be to say goodbye to nested cursors.
    You need:
    the in_cust_id_query
    extend SUPPLY_ORDER with a new field
    max(CREATED_DATE) over (partiontion by cust_id) max_created_dateextend XCOM_ORDER_HEADER with a new field
    max(SPLY_ORD_DT)over (partiontion by cust_id) max_sply_ord_dateThen you make a 3 level SELECT
    the innerst () join all 3 sources
    the second level names the rule
    the outermost level applies the rule to each field:
    SELECT
    -- case statement to each field:
    CASE rule
    WHEN 1 THEN null
    WHEN 2 THEN s_smo_no
    WHEN 3 .... END  SMO_NO,
    SELECT
    -- check all rules:
    case
    --• Both table queries return no records
    when s_in_cust_id IS NULL and h_in_cust_id IS NULL then 1
    --• SUPPLY_ORDER returns a record, but XCOM_ORDER_HEADER returns no records
    when s_in_cust_id IS NOT NULL and h_in_cust_id IS NULL then 2
    --• SUPPLY_ORDER returns no records, but XCOM_ORDER_HEADER returns one record
    when s_in_cust_id IS NULL and h_in_cust_id IS NOT NULL then 3
    ELSE 4 end rule_id,
    i.*
    (SELECT c.in_cust_id,
                 s.*, (with alias of course eg. s_...)
                h.*, (with alias of course  e.g. h_...)
    from  in_cust_id_query c
      LEFT JOIN SUPPLY_ORDER s
       on (c.in_cust_id = s.in_cust_id)
    LEFT XCOM_ORDER_HEADER h
      on (c.in_cust_id = h.in_cust_id) i;I hope you get it.
    Of course you can do what you probable currently do. Open both cursors one by one and compare the results. But when you have 10000 in_cust_ids you start 20000 queries and you have a lot of code.
    This method I'm showing need these roles coded as well, but you'll have ONE single query and that will be as fast as ORACLE can be. And I believe it's easier to read too. (But not simple!)
    If you need more help, try to supply an example we can work on.
    -- andy

  • Creating a external content type for Read and Update data from two tables in sqlserver using sharepoint designer

    Hi
    how to create a external content type for  Read and Update data from two tables in  sqlserver using sharepoint designer 2010
    i created a bcs service using centraladministration site
    i have two tables in sqlserver
    1)Employee
    -empno
    -firstname
    -lastname
    2)EmpDepartment
    -empno
    -deptno
    -location
    i want to just create a list to display employee details from two tables
    empid firstname deptno location
    and same time update  in two tables
    adil

    When I try to create an external content type based on a view (AdventureWorks2012.vSalesPerson) - I can display the data in an external list.  When I attempt to edit it, I get an error:
    External List fails when attached to a SQL view        
    Sorry, something went wrong
    Failed to update a list item for this external list based on the Entity (External Content Type) 'SalesForce' in EntityNamespace 'http://xxxxxxxx'. Details: The query against the database caused an error.
    I can edit the view in SQL Manager, so it seems strange that it fails.
    Any advice would be greatly GREATLY appreciated. 
    Thanks,
    Randy

Maybe you are looking for