Outer Join not returning rows

Hi,
i have a view based on the following statement. I can't get the unmatched rows from table 'npe' to show up in the result.
SELECT DISTINCT rctla.customer_trx_id, msi.segment1 item_number,
                rcta.trx_date trx_date, rcta.bill_to_customer_id cust_id,
                (rctla.quantity_invoiced) * NVL (msi.attribute13, 1) quantity,
                ROUND ((rctla.unit_selling_price * rctla.quantity_invoiced),
                       0
                      ) net_sales,
                ROUND ((cic.material_cost * rctla.quantity_invoiced),
                       0
                      ) product_cost,
                ROUND ((npe.expense * rctla.quantity_invoiced), 0) expense,
                ROUND (  (rctla.unit_selling_price * rctla.quantity_invoiced
                       - (  cic.material_cost * rctla.quantity_invoiced
                          + rctla.quantity_invoiced * npe.expense
                       0
                      ) gp_dollars
           FROM ra_customer_trx_all rcta,
                ra_customer_trx_lines_all rctla,
                cst_cost_types cct,
                cst_item_costs cic,
                mtl_system_items_b msi,
                nfpc.nfpc_gpm_expense npe,
                hz_cust_accounts hca
          WHERE rcta.complete_flag = 'Y'
            AND rcta.interface_header_attribute1 NOT LIKE '%B'
            AND rcta.interface_header_context = 'ORDER ENTRY'
            AND rcta.batch_source_id IN (1068, 1069)
            AND rcta.customer_trx_id = rctla.customer_trx_id
            AND rctla.inventory_item_id = msi.inventory_item_id
            AND UPPER (cct.cost_type) = 'FROZEN'
            AND cic.cost_type_id = cct.cost_type_id
            AND cic.inventory_item_id = msi.inventory_item_id
            AND npe.customer_no = hca.account_number
            AND hca.cust_account_id = rcta.bill_to_customer_id
            AND rcta.trx_date BETWEEN '01-FEB-10' AND '01-FEB-10'
            AND rctla.inventory_item_id = npe.inventory_item_id(+)
            AND rctla.customer_trx_id = '903670';I know there are two inventory_item_id rows that are not in the nfpc_gpm_expense table but are in the 'rctla' and 'msi' tables.
I am on RDBMS 9i .
Thanks in advance for your time.
A/A

Hi Asgar,
check if this helps:
SELECT DISTINCT rctla.customer_trx_id, msi.segment1 item_number,
                rcta.trx_date trx_date, rcta.bill_to_customer_id cust_id,
                (rctla.quantity_invoiced) * NVL (msi.attribute13, 1) quantity,
                ROUND ((rctla.unit_selling_price * rctla.quantity_invoiced),
                       0
                      ) net_sales,
                ROUND ((cic.material_cost * rctla.quantity_invoiced),
                       0
                      ) product_cost,
                ROUND (( nvl(npe.expense,1 ) * rctla.quantity_invoiced), 0) expense,   --included NVL
                ROUND (  (rctla.unit_selling_price * rctla.quantity_invoiced
                       - (  cic.material_cost * rctla.quantity_invoiced
                          + rctla.quantity_invoiced * nvl(npe.expense,1 )                        --included NVL
                       0
                      ) gp_dollars
           FROM ra_customer_trx_all rcta,
                ra_customer_trx_lines_all rctla,
                cst_cost_types cct,
                cst_item_costs cic,
                mtl_system_items_b msi,
                ( select nge.expense, nge.inventory_item_id, rctla2.customer_trx_line_id
                  from nfpc.nfpc_gpm_expense nge,
                       hz_cust_accounts_all hcaa,
                       ra_customer_trx_all rcta2,
                       ra_customer_trx_lines_all rctla2
                  where nge.customer_no = hcaa.account_number
                  and   hcaa.cust_account_id = rcta2.bill_to_customer_id
                  and   rcta2.customer_trx_id = rctla2.customer_trx_id
                ) npe,                                      --created inline view for npe
                --nfpc.nfpc_gpm_expense npe,                --commented
                hz_cust_accounts hca
          WHERE rcta.complete_flag = 'Y'
            AND rcta.interface_header_attribute1 NOT LIKE '%B'
            AND rcta.interface_header_context = 'ORDER ENTRY'
            AND rcta.batch_source_id IN (1068, 1069)
            AND rcta.customer_trx_id = rctla.customer_trx_id
            AND rctla.inventory_item_id = msi.inventory_item_id
            AND UPPER (cct.cost_type) = 'FROZEN'
            AND cic.cost_type_id = cct.cost_type_id
            AND cic.inventory_item_id = msi.inventory_item_id
            --AND npe.customer_no = hca.account_number        --commented
            AND hca.cust_account_id = rcta.bill_to_customer_id
            AND rcta.trx_date BETWEEN '01-FEB-10' AND '01-FEB-10'
            AND rctla.inventory_item_id = npe.inventory_item_id(+)
            AND rctla.customer_trx_line_id = npe.customer_trx_line_id(+)
            AND rctla.customer_trx_id = '903670';Regards
Imran

Similar Messages

  • Outer join not returning missing records.

    Hi All,
    Can you please look at the query and see why I don't get any record. There is no item '0141884' for cust_id '1259' in the nfpc_gpm_expense table.
    Thank you in advance.
    A/A
       SELECT DISTINCT rctla.customer_trx_id, msi.segment1 item_number,
                       rcta.trx_date trx_date, rcta.bill_to_customer_id cust_id,
                         (rctla.quantity_invoiced)
                       * NVL (msi.attribute13, 1) quantity,
                         rctla.unit_selling_price
                       * rctla.quantity_invoiced net_sales,
                       cic.material_cost * rctla.quantity_invoiced product_cost,
                         (rctla.unit_selling_price * rctla.quantity_invoiced
                       --  - (rctla.unit_selling_price * rctla.quantity_credited)
                       - (cic.material_cost * rctla.quantity_invoiced) gp_dollars,
                       nge.expense_amt
                  FROM ra_customer_trx_all rcta,
                       ra_customer_trx_lines_all rctla,
                       cst_cost_types cct,
                       cst_item_costs cic,
                       mtl_system_items_b msi,
                       nfpc_gpm_expense nge
              WHERE rcta.complete_flag = 'Y'
                   AND rcta.interface_header_attribute1 NOT LIKE '%B'
                   AND rcta.interface_header_context = 'ORDER ENTRY'
                   AND rcta.batch_source_id IN (1068, 1069)
                   AND rcta.customer_trx_id = rctla.customer_trx_id
                   AND rctla.inventory_item_id = msi.inventory_item_id
                   AND UPPER (cct.cost_type) = 'FROZEN'
                   AND cic.cost_type_id = cct.cost_type_id
                   AND cic.inventory_item_id = msi.inventory_item_id
                   and rcta.trx_date = '01-DEC-2009'
                  and msi.segment1 = '0141884'
                   and rcta.bill_to_customer_id = '1259'
                   and msi.segment1= nge.item_number(+)
                   and rctla.ATTRIBUTE1 = nge.DIVISION
                   and rcta.bill_to_customer_id = nge.CUST_ID
                  

    Table nfpc_gpm_expense is
      CUSTOMER_NO        VARCHAR2(20),
      ITEM_NUMBER        VARCHAR2(10),
      EXPENSE_AMT        VARCHAR2(20),
      DIVISION           VARCHAR2(20),
      INVENTORY_ITEM_ID  VARCHAR2(20),
      CUST_ID            VARCHAR2(20)Sample data in this table is
    CUSTOMER_NO     ITEM_NUMBER     EXPENSE_AMT     DIVISION     INVENTORY_ITEM_ID     CUST_ID
    02250000     0261884          1.76          B          8716               1259And this is the result of the query. Note that item 0141884 is missing from the result while as this item was sold on that day for this customer but since it is not in the nfpc_gpm_expense table, it doesn't show up.
    CUSTOMER_TRX_ID     ITEM_NUMBER     DIVISION     TRX_DATE     CUST_ID     QUANTITY     ORDER_NO     EXPENSE_AMT     NET_SALES     PRODUCT_COST     GP_DOLLARS     EXPENSE
    887617     0261884     B     12/1/2009     1259     60     1047572     1.76     662.4     338.4     324     105.6Edited by: asgar_amin on Mar 5, 2010 12:46 PM

  • Select query does not return rows

    Hi all,
    The following query does not returning rows even though values are there in table.
    Kindly let me know why it is creating problem.
    thanks, P Prakash
    /* Formatted on 2011/05/11 16:44 (Formatter Plus v4.8.8) */
    SELECT pr.pa_rqst_sid, ptr.sbmtr_trnsctn_idntfr, ptr.athrztn_infrmtn,
    DECODE (ou.org_unit_name,
    'PA - MDCH', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_1_PA'),
    'PA - MPRO', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_2_PA'),
    'PA - DEFAULT', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_1_PA'),
    NULL
    ) AS intrchng_sndr_idntfr,
    ptr.intrchng_sndr_idntfr AS intrchng_rcvr_idntfr, ptr.usg_indctr,
    ptr.intrchng_sndr_idntfr AS applctn_rcvr_code,
    ptr.trnsctn_set_cntrl_nmbr AS trnsctn_set_cntrl_nmbr,
    ptr.athrztn_infrmtn_qlfr AS athrztn_infrmtn_qlfr,
    ptr.scrty_infrmtn_qlfr AS scrty_infrmtn_qlfr,
    ptr.scrty_infrmtn AS scrty_infrmtn,
    ptr.intrchng_sndr_idntfr_qlfr AS intrchng_sndr_idntfr_qlfr,
    ptr.intrchng_rcvr_idntfr_qlfr AS intrchng_rcvr_idntfr_qlfr,
    ptr.intrchng_cntrl_stndrds_idntfr AS intrchng_cntrl_stndrds_idntfr,
    ptr.intrchng_cntrl_vrsn_nmbr AS intrchng_cntrl_vrsn_nmbr,
    ptr.intrchng_cntrl_nmbr AS intrchng_cntrl_nmbr,
    ptr.acknwldgmnt_rqstd_indctr AS acknwldgmnt_rqstd_indctr,
    ptr.cmpnt_elmnt_sprtr AS cmpnt_elmnt_sprtr,
    ptr.fnctnl_idntfr_code AS fnctnl_idntfr_code,
    ptr.grp_cntrl_nmbr AS grp_cntrl_nmbr,
    ptr.rspnsbl_agncy_code AS rspnsbl_agncy_code,
    ptr.vrsn_rls_indstry_idntfr_code AS vrsn_rls_indstry_idntfr_code
    FROM pa_request pr, pa_transaction_request ptr, org_unit ou
    WHERE ptr.pa_trnsctn_rqst_sid = pr.pa_trnsctn_rqst_sid
    AND pr.org_unit_sid = ou.org_unit_sid
    AND pr.oprtnl_flag = 'A'
    AND ptr.oprtnl_flag = 'A'
    AND ou.oprtnl_flag = 'A'
    AND pr.pa_mode_type_lkpcd = 'BT'
    AND (pr.status_cid = 86 OR pr.status_cid IN
    (20, 70, 30, 80, 25, 101, 96)
    AND pr.pa_rqst_sid = 75006271
    ORDER BY pr.pa_rqst_sid;
    the query is not giving result for this particular request sid.75006271 is present in table.

    833560 wrote:
    Hi all,
    The following query does not returning rows even though values are there in table.
    Kindly let me know why it is creating problem.
    thanks, P Prakash
    /* Formatted on 2011/05/11 16:44 (Formatter Plus v4.8.8) */
    SELECT pr.pa_rqst_sid, ptr.sbmtr_trnsctn_idntfr, ptr.athrztn_infrmtn,
    DECODE (ou.org_unit_name,
    'PA - MDCH', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_1_PA'),
    'PA - MPRO', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_2_PA'),
    'PA - DEFAULT', (SELECT property_value
    FROM hipaa_system_defaults
    WHERE property_name = 'RECEIVER_ID_1_PA'),
    NULL
    ) AS intrchng_sndr_idntfr,
    ptr.intrchng_sndr_idntfr AS intrchng_rcvr_idntfr, ptr.usg_indctr,
    ptr.intrchng_sndr_idntfr AS applctn_rcvr_code,
    ptr.trnsctn_set_cntrl_nmbr AS trnsctn_set_cntrl_nmbr,
    ptr.athrztn_infrmtn_qlfr AS athrztn_infrmtn_qlfr,
    ptr.scrty_infrmtn_qlfr AS scrty_infrmtn_qlfr,
    ptr.scrty_infrmtn AS scrty_infrmtn,
    ptr.intrchng_sndr_idntfr_qlfr AS intrchng_sndr_idntfr_qlfr,
    ptr.intrchng_rcvr_idntfr_qlfr AS intrchng_rcvr_idntfr_qlfr,
    ptr.intrchng_cntrl_stndrds_idntfr AS intrchng_cntrl_stndrds_idntfr,
    ptr.intrchng_cntrl_vrsn_nmbr AS intrchng_cntrl_vrsn_nmbr,
    ptr.intrchng_cntrl_nmbr AS intrchng_cntrl_nmbr,
    ptr.acknwldgmnt_rqstd_indctr AS acknwldgmnt_rqstd_indctr,
    ptr.cmpnt_elmnt_sprtr AS cmpnt_elmnt_sprtr,
    ptr.fnctnl_idntfr_code AS fnctnl_idntfr_code,
    ptr.grp_cntrl_nmbr AS grp_cntrl_nmbr,
    ptr.rspnsbl_agncy_code AS rspnsbl_agncy_code,
    ptr.vrsn_rls_indstry_idntfr_code AS vrsn_rls_indstry_idntfr_code
    FROM pa_request pr, pa_transaction_request ptr, org_unit ou
    WHERE ptr.pa_trnsctn_rqst_sid = pr.pa_trnsctn_rqst_sid
    AND pr.org_unit_sid = ou.org_unit_sid
    AND pr.oprtnl_flag = 'A'
    AND ptr.oprtnl_flag = 'A'
    AND ou.oprtnl_flag = 'A'
    AND pr.pa_mode_type_lkpcd = 'BT'
    AND (pr.status_cid = 86 OR pr.status_cid IN
    (20, 70, 30, 80, 25, 101, 96)
    AND pr.pa_rqst_sid = 75006271
    ORDER BY pr.pa_rqst_sid;
    Hi,
    Its very difficult to analyse the query without any data being provided. So I suggest you to debug the above query by keeping basic join condition intact and comment out all the other where conditions for initial run.
    FROM pa_request pr, pa_transaction_request ptr, org_unit ou
    WHERE ptr.pa_trnsctn_rqst_sid = pr.pa_trnsctn_rqst_sid
    --AND pr.org_unit_sid = ou.org_unit_sid
    --AND pr.oprtnl_flag = 'A'
    --AND ptr.oprtnl_flag = 'A'
    --AND ou.oprtnl_flag = 'A'
    --AND pr.pa_mode_type_lkpcd = 'BT'
    --AND (pr.status_cid = 86 OR pr.status_cid IN
    (20, 70, 30, 80, 25, 101, 96)
    --AND pr.pa_rqst_sid = 75006271If if you have given join conditions proper and if data exists ,you can see set of rows displayed.
    Next step is to keep on uncommenting each of the where condition
    AND pr.oprtnl_flag = 'A'Like this you 'll come to the condition which does not match your requirement
    Hope this helps
    Regards,
    Achyut

  • ORA-30563, Outer Join not allowed in select list

    I can not find any information about this error message that I am getting.
    I have just upgraded my Oracle database from Version 7.3 to Version 8.1.7, a stored procedure that was written in v7.3 has outer joins in the select statement.
    when trying to run this proc in version 8 I get this meesage.(ORA-30563, Outer Join not allowed in select list)
    code ex:
    Select alt.id
    decode(alt.advise, NULL, NULL, AA.act_yr(+))||'-'||AA.act_per(+)||'-'||AA.Acc_per_no(+)) as advise_no
    from alt, AA;
    Is there any information about this message anywhere? or does anybody know if this is a known issue with oracle ver 8.1.7?
    Thanks
    CJ

    It appears to have been a bug in 7.x
    From a metalink note on bugs fixed in 8i (doc 132632.1)
    974742 Oracle does not report an error if (+) is specified in select-list. The OUTER JOIN operator (+) is only valid in WHERE clause predicates. As this is not flagged as an error the query can give unexpected results. The correct action to avoid this problem is to fix the query.
    Ken

  • Second level detail in master-detail via VL does not return rows

    Sorry, I did not want to repost the entire thread. Please see the last entry in the following thread for my urgent question.
    second level detail in master-detail-detail does not return rows
    "second level detail in master-detail-detail does not return rows"
    Thanks so much!
    Teri

    Ahhh ... that explains everything!
    You wrote:
    ListView1
    -> ListRowView2 (via ListRowFkLink1)
    -> ListValueView2 (via ListValueFkLink2)
    That's why I thought it's a master and two details.
    But it's more like:
    ListView1
        -> ListRowView2 (via ListRowFkLink1)
              -> ListValueView2 (via ListValueFkLink2)Is that correct?
    That's the explanation.
    A ViewLink is basically a RowSetIterator controlling a detail RowSet. When the iterator navigates, the detail RS is refreshed.
    When you create a hierarchy in the wizard, the controlling master iterator is always the default iterator! But you used a new iterator (listRowIter) to iterate over your first detail. The default iterator of that first detail didn't move, hence the RowSet of your second detail was not refreshed.
    When you navigate in the tester, the tester always uses the default iterator. That's why it worked there.
    Sascha

  • I found out issue distinct clause in query ,refcursor not returning rows

    URGENT
    hi the following procedure returns records  but when i add  distinct clause to (open v_refcursor for select )
    i.e   open v_refcursor for select distinct column1,column2   .......... in the procedure the procedure is not returning records. please help what is the issue here?
    CREATE OR REPLACE procedure proc_shared_report3 (in_cust_id varchar2,in_user_array user_tab , in_acct_array acct_tab,in_report_pvlg_hier varchar2,in_fmt_pvlg_hier varchar2,v_refcursor OUT sys_refcursor)
    is
    BEGIN
    if  in_acct_array.count>0 and in_fmt_pvlg_hier is not null and in_cust_id is not null and in_user_array.count>0 and in_report_pvlg_hier is not null  then
    dbms_output.put_line('all are not null');
    *open v_refcursor for  select usr_id* from vw_get_user_profile where usr_id in (
            SELECT USR_ID FROM VW_GET_ACCOUNTS WHERE USR_ID IN (SELECT distinct up1.usr_id FROM vw_get_user_privileges up1,vw_get_user_privileges up2  WHERE 
            up1.usr_id=up2.usr_id and
            up1.product_hierarchy=in_report_pvlg_hier  and up2.PRODUCT_HIERARCHY=in_fmt_pvlg_hier AND up1.usr_id in (select usr_id from vw_get_user_for_customer where
            cust_id=in_cust_id)
            and up1.usr_id Member Of in_user_array) AND acct_nb Member of in_acct_array);
    /* if account list is null and rest all  not  null */
    elsif (in_acct_array is null or in_acct_array IS EMPTY or in_acct_array.count = 0) and in_fmt_pvlg_hier is not  null  and in_cust_id is not null and in_user_array.count>0 and in_report_pvlg_hier is not null  then
    dbms_output.put_line('acc is null and rest are not null');
    *open v_refcursor for select usr_id,usr_type_cd* from vw_get_user_profile where usr_id in(SELECT  distinct up1.usr_id FROM vw_get_user_privileges up1,vw_get_user_privileges up2  WHERE 
              up1.usr_id=up2.usr_id and
              up1.product_hierarchy=in_report_pvlg_hier and up2.PRODUCT_HIERARCHY=in_fmt_pvlg_hier AND   up1.usr_id in (select usr_id from vw_get_user_for_customer where
              cust_id=in_cust_id)
              and up1.usr_id Member Of in_user_array);
    /* if account list is null and format pvlg hierarchy is null */
    elsif  (in_acct_array is null or in_acct_array IS EMPTY or in_acct_array.count = 0) and in_fmt_pvlg_hier is null and in_cust_id is not null and in_user_array.count>0 and in_report_pvlg_hier is not null
    then
    dbms_output.put_line('acc is null and format is null null');
    *open v_refcursor for select usr_id,tmzon_cd* from vw_get_user_profile where usr_id in (
      (SELECT  distinct usr_id FROM vw_get_user_privileges  WHERE  product_hierarchy=in_report_pvlg_hier  AND   usr_id in (select usr_id from vw_get_user_for_customer where
       cust_id=in_cust_id)
       and usr_id Member Of in_user_array))  ;
    /* if account list is not null and format pvlg hierarchy is  null */
    else  -- If i get only one privilege and all other inputs then 
    dbms_output.put_line('acc list is not null and format pvlg is null');
    *open v_refcursor for select usr_id,prod_shrt_nm* from vw_get_user_profile where usr_id in (
         SELECT USR_ID FROM VW_GET_ACCOUNTS WHERE USR_ID IN (SELECT  distinct usr_id FROM vw_get_user_privileges  WHERE 
         product_hierarchy=in_report_pvlg_hier  AND   usr_id in (select usr_id from vw_get_user_for_customer where
         cust_id=in_cust_id) and usr_id Member Of in_user_array ) AND acct_nb Member of in_acct_array);
    END IF;
    END proc_shared_report3;
    /Edited by: raj_fresher on Aug 12, 2009 8:50 AM
    Edited by: raj_fresher on Aug 12, 2009 1:40 PM

    its like this ...... ?
    You have to understand that without any testdata/ a reproducable testcase, all I can do is asking you to test some alternatives, I'm just guessing things from what I can make of your example, and hope you'll repost back any differences in a clear and concisive way.
    What I didn't understand is why you're not just joining your tables/views instead of using inner queries.
    Unfortunatly you're not providing any feedback on that, on the other hand you've narrowed down your problem to a specific part of your query? But you're not sharing why/what makes you decide to take that turn.
    But: you're still using inner queries in your reply.
    So, sorry, I cannot proceed/say anything useful unless you answer my previous post.
    Because, there are still many other questions/doubts: I don't understand why you're not aliasing your columns properly, for example.
    I don't know why you've suddenly switched to VW_GET_USER_cust_sa?
    I don't know if you've tried the straight join instead of nesting queries?
    And if you did, what's the problem?
    Please read and understand this, so you'll get your answers by the speed of light the next time you've got a question or problem:
    http://tkyte.blogspot.com/2005/06/how-to-ask-questions.html
    And don't refrain from using that tag ;)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Dynamic From statement in select query and/or outer join not working

    Dear Experts, I have a select query where the select columns are dynamic, the where condition is also dynamic. It is of the below format:
    Select (dynamic columns) INTO <wa>
    FROM a inner join b on af1 = bf1
    inner join c on af2 = cf2......
    WHERE (dynamic conditios)
    ORDER BY ( dynamic sort condition).
    Now I have to include some tables (dynamically depending on the user input) in the inner join statement which will give description for the selected fields. And these database tables may or may no be empty. So in this case, my select query will not return any data if these tables are empty. And I dont want that.
    I tried using outer join for the extra tables but it gave me a runtime error. I also tried forming the inner join statement dynamically but it was not supporting.
    Kindly give me pointers.
    Thanks

    Hey thanks for the reply, but the problem is not solved.
    I am already using  ( fileds, value) like table in my where condition and the select statement was working properly.
    the problem is that now I have to include some tables in the join statement which can be empty and so i want to use Outer join.
    But I am getting a runtime error as below:
    Error analysis
        An exception occurred that is explained in detail below.
        The exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SYNTAX', was not
         caught in
        procedure "ZATSCSNG_RFC_READ_TABLE" "(FUNCTION)", nor was it propagated by a
         RAISING clause.
        Since the caller of the procedure could not have anticipated that the
        exception would occur, the current program is terminated.
        The reason for the exception is:
        The running ABAP program wanted to execute a SELECT statement whose
        WHERE condition was (partly) specified dynamically. The part that is
        specified in an internal table at runtime is compared to a field of the
        right table of an LEFT OUTER JOIN. Such comparisons are not supported by
         all database systems and are therefore not allowed.

  • Merging two complemental result sets... or OUTER JOINs not working?

    Dear experts!
    Again I have a very difficult problem for which I ask Your help, but this time I am better prepared than last time and can deliver sample data of my (hopefully not too much) simplified example:
    create table Subjects(
    pk_id          number          not null primary key,
    title          varchar2(128)
    create table People(
    pk_id          number          not null primary key,
    name          varchar2(128)
    create table Results(
    pk_id          number          not null primary key,
    fk_subjects_id     number,
    fk_people_id     number,
    result          number
    insert into Subjects(pk_id, title) values (1, 'Choosing a recipe')
    insert into Subjects(pk_id, title) values (2, 'Shopping ingredients')
    insert into Subjects(pk_id, title) values (3, 'Preparations')
    insert into Subjects(pk_id, title) values (4, 'Cooking for beginners')
    insert into Subjects(pk_id, title) values (5, 'Eating for pros')
    insert into Subjects(pk_id, title) values (6, 'Dishwashing for everyone')
    insert into Subjects(pk_id, title) values (7, 'Digesting for experts')
    insert into Subjects(pk_id, title) values (8, 'Becoming hungry again...')
    insert into Subjects(pk_id, title) values (9, 'Redo from start')
    insert into People(pk_id, name) values (1, 'Hank')
    insert into People(pk_id, name) values (2, 'Cloe')
    insert into People(pk_id, name) values (3, 'Mary')
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (1, 1, 1, 2)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (2, 2, 1, 4)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (3, 3, 1, 3)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (4, 9, 1, 5)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (5, 1, 2, 4)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (6, 2, 2, 1)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (7, 3, 2, 5)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (8, 4, 2, 2)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (9, 5, 2, 3)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (10, 6, 2, 2)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (11, 7, 2, 1)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (12, 4, 3, 3)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (13, 5, 3, 5)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (14, 7, 3, 1)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (15, 8, 3, 5)
    insert into Results(pk_id, fk_subjects_id, fk_people_id, result) values (16, 9, 3, 1)
    Please imagine this as an university for amateur cooks. Now I want to present them their performance record/"scorecard", for every student, only with her or his marks. On this performance record there should be a list of all 9 subjects possible to pass, and where students got a result, that result should be filled in. I thought that should be possible to achieve with something like this:
    SELECT PEOPLE.NAME, SUBJECTS.TITLE, RESULTS.RESULT FROM RESULTS
    JOIN PEOPLE ON PEOPLE.PK_ID = RESULTS.FK_PEOPLE_ID
    JOIN SUBJECTS ON SUBJECTS.PK_ID = RESULTS.FK_SUBJECTS_ID
    WHERE RESULTS.FK_PEOPLE_ID = 2
    But also using (LEFT|RIGHT|FULL) OUTER JOINs here does not help me to get what I want, I always only get
    NAME TITLE RESULT
    Cloe Choosing a recipe 4
    Cloe Shopping ingredients 1
    Cloe Preparations 5
    Cloe Cooking for beginners 2
    Cloe Eating for pros 3
    Cloe Dishwashing for everyone 2
    Cloe Digesting for experts 1
    But I want:
    NAME TITLE RESULT
    Cloe Choosing a recipe 4
    Cloe Shopping ingredients 1
    Cloe Preparations 5
    Cloe Cooking for beginners 2
    Cloe Eating for pros 3
    Cloe Dishwashing for everyone 2
    Cloe Digesting for experts 1
    Cloe Becoming hungry again...
    Cloe Redo from start
    Without having to fill in empty rows for all students which did not take all exams yet.
    Is it possible? If so, how?
    Thank You very much in advance and Happy Easter to everyone! :-)
    With kind regards,
    Chriss
    Edited by: user9355711 on 01.04.2010 07:01
    Edited by: user9355711 on 01.04.2010 07:28
    Edited by: user9355711 on 01.04.2010 07:29

    Also;
    var n number
    exec :n := 2;
    PL/SQL procedure successfully completed
    n
    2
    select ppl.name, sub.title, res.result
      from subjects sub, people ppl, results res
    where sub.pk_id = res.fk_subjects_id(+)
       and ppl.pk_id = :n
       and res.fk_people_id(+) = :n
    order by sub.title;
    NAME       TITLE                         RESULT
    Cloe       Becoming hungry again... 
    Cloe       Choosing a recipe                  4
    Cloe       Cooking for beginners              2
    Cloe       Digesting for experts              1
    Cloe       Dishwashing for everyone           2
    Cloe       Eating for pros                    3
    Cloe       Preparations                       5
    Cloe       Redo from start          
    Cloe       Shopping ingredients               1

  • Outer join not working

    Hello everybody,
    I have a folder based on materialized view (Detailed folder). There is another folder which is based on a table (master folder). i have created a jooin and select option as "outer join on master folder". The join is not working properly. Am i doing asomething wrong. Discoverer version is 10.1.2 and database version is 10.2.0.3. i have been creating outer joins among folders based on tables but i am not sure about whats wrong this time??? materalized view defination is as follows:
    CREATE MATERIALIZED VIEW MW
    BUILD IMMEDIATE
    REFRESH FORCE
    START WITH SYSDATE
    NEXT TRUNC(SYSDATE+1)+1/4
    WITH PRIMARY KEY
    AS
    SELECT * FROM VIEW
    Thanx for your help
    Regards,
    Najeeb

    So, let me see if I got this...
    You have a table and a materialized view. There is a join between the two, where the table is the master, and the MV is the detail. The join is set to be an outer join on master. Ultimately, you want to see the values in the MV where the join condition is NULL.
    What boggles me is that you say the query runs fine in the database, but not in Disco. This could mean that there is a condition in the BA or in the worksheet. But, if that were the case, the condition should show up in the SQL generated by Disco.
    It looks like the where clause is the problem. NULL is never equal to anything, so when APPROVEDBY is null, the where clause should fail and no data returned. This explains Disco's behavior, but not SQL's.
    Something to try: Create a calculation in the materialized view folder of the business area like:
    NVL(APPROVEDBY, -1)
    I am assuming that all of your IDs are positive. Then modify the join to use the calculated column. This should convert the NULLS to values, and the report should work.

  • Outer join not working when filters are applied from Prompts

    Hi,
    Without values being selected from the dashboard prompts, my outer join is working fine with all the rows and all the columns showing up( as per requirement). But as soon as I select values in the prompts, only certain rows and columns show up.
    BTW, I have 2 prompts Year and Quarter. I put Year is Prompted or is null in the criteria. It works. BUT as soon as I also put in quarter numbers, it does not work.
    Is there a workaround for this?
    Thanks,
    Dan
    Edited by: Danny on Apr 26, 2013 12:10 PM

    I just experimented by adding is null to not only the year and quarter but to the row and column too and it worked!
    Thanks,
    Dan

  • Outer Join creating duplicated rows (sort of)

    Greetings Forum,
    Using version MII 11.5 sp 6
    Joining two unique xml documents on three common columns using the Join Action block set up for an outer join.  The results of the join are
    Set a          Set b           results in
    c1   c2        c1   c3         c1   c2   c3
    a    a1        a    a2         a    a1   a2
    b    b1        b    b2         a    a1   ---    this row is extra
    c    c1                        b    b1   b2
    d    d1                        b    b1   ---    this row is extra
                                   c    c1   ---
                                   d    d1   ---
    in this example the two extra rows match set a and not in set b even though they did have matching data.
    Any Ideas.  We have tryed deleting the join action and recreating it.  Doing the join with two local xml documents....

    Actually, It's three columns matched up to three columns.  Attached is an actual sample right out of BLS.
    [INFO SET 1 ]: <?xml version="1.0" encoding="UTF-8"?><Rowsets DateCreated="2008-08-12T15:50:16" EndDate="2008-08-12T16:27:22" StartDate="2008-08-12T16:27:22" Version="11.5.3">
         <Rowset>
              <Columns>
                   <Column Description="a" MaxRange="1" MinRange="0" Name="a" SQLDataType="1" SourceColumn="a"/>
                   <Column Description="b" MaxRange="1" MinRange="0" Name="b" SQLDataType="1" SourceColumn="b"/>
                   <Column Description="c" MaxRange="1" MinRange="0" Name="c" SQLDataType="1" SourceColumn="c"/>
                   <Column Description="d" MaxRange="1" MinRange="0" Name="d" SQLDataType="8" SourceColumn="d"/>
              </Columns>
              <Row>
                   <a>a1</a><b>b1</b><c>c1</c><d>d1</d>
              </Row>
              <Row>
                   <a>a2</a><b>b2</b><c>c2</c><d>d2</d>
              </Row>
              <Row>
                   <a>a3</a><b>b3</b><c>c3</c><d>d3</d>
              </Row>
              <Row>
                   <a>a4</a><b>b4</b><c>c4</c><d>d4</d>
              </Row>
         </Rowset>
    </Rowsets>
    [INFO SET 2]: <?xml version="1.0" encoding="UTF-8"?><Rowsets DateCreated="2008-08-12T15:50:16" EndDate="2008-08-12T16:27:22" StartDate="2008-08-12T16:27:22" Version="11.5.3">
         <Rowset>
              <Columns>
                   <Column Description="a" MaxRange="1" MinRange="0" Name="a" SQLDataType="1" SourceColumn="a"/>
                   <Column Description="b" MaxRange="1" MinRange="0" Name="b" SQLDataType="1" SourceColumn="b"/>
                   <Column Description="c" MaxRange="1" MinRange="0" Name="c" SQLDataType="1" SourceColumn="c"/>
                   <Column Description="e" MaxRange="1" MinRange="0" Name="e" SQLDataType="1" SourceColumn="e"/>
              </Columns>
              <Row>
                   <a>a1</a><b>b1</b><c>c1</c><e>e1</e>
              </Row>
              <Row>
                   <a>a2</a><b>b2</b><c>c2</c><e>e2</e>
              </Row>
         </Rowset>
    </Rowsets>
    [INFO RESEULTs]: <?xml version="1.0" encoding="UTF-8"?><Rowsets DateCreated="2008-08-12T15:50:16" EndDate="2008-08-12T16:27:22" StartDate="2008-08-12T16:27:22" Version="10.0">
         <Rowset>
              <Columns>
                   <Column Description="a" MaxRange="1" MinRange="0" Name="a" SQLDataType="1" SourceColumn="a"/>
                   <Column Description="b" MaxRange="1" MinRange="0" Name="b" SQLDataType="1" SourceColumn="b"/>
                   <Column Description="c" MaxRange="1" MinRange="0" Name="c" SQLDataType="1" SourceColumn="c"/>
                   <Column Description="d" MaxRange="1" MinRange="0" Name="d" SQLDataType="8" SourceColumn="d"/>
                   <Column Description="e" MaxRange="1" MinRange="0" Name="e" SQLDataType="1" SourceColumn="e"/>
              </Columns>
              <Row>
                   <a>a1</a><b>b1</b><c>c1</c><d>d1</d><e>e1</e>
              </Row>
              <Row>
                   <a>a1</a><b>b1</b><c>c1</c><d>d1</d><e>---</e>
              </Row>
              <Row>
                   <a>a2</a><b>b2</b><c>c2</c><d>d2</d><e>e2</e>
              </Row>
              <Row>
                   <a>a2</a><b>b2</b><c>c2</c><d>d2</d><e>---</e>
              </Row>
              <Row>
                   <a>a3</a><b>b3</b><c>c3</c><d>d3</d><e>---</e>
              </Row>
              <Row>
                   <a>a4</a><b>b4</b><c>c4</c><d>d4</d><e>---</e>
              </Row>
         </Rowset>
    </Rowsets>

  • Sp_sproc_columns not returning row for "@RETURN_VALUE"

    Hello folks...
    I have published a CLR stored procedure to replace a "normally created" stored procedure.
    If I execute "sp_sproc_columns" for the CLR procedure, it does not return a row for "@RETURN_VALUE".
    If I execute "sp_sproc_columns" for any normally created stored procedures, there is a row for "@RETURN_VALUE".
    Code used:  exec sp_sproc_columns N'PROC_NAME_HERE',@ODBCVer=3
    For backwards compatibility issues, I need the "@RETURN_VALUE" row to be returned for all CLR Stored procedures.
    My CLR stored procedure executes no problem when manually run.  It looks like this:
    [Microsoft.SqlServer.Server.SqlProcedure]
     public static SqlInt32 proc_CreateNewFile(out String filename)
        return 0;
    I have tried changing the data type so INT is returned, but no luck either.
    SQL Server 2014 is the version being used.
    Thanks!

    And as a workaround you might call a TSQL wrapper proc instead of calling the CLR proc directly.
    David
    David http://blogs.msdn.com/b/dbrowne/

  • Left Outer Join Not working in BI 7.0 Infoset

    Hi All,
    I am working on BI 7.0. I have to create a report where I have to display the Target values from a target DSO against the transactional data (Operational data).
    I have a DSO where for a “subteam” value target has been set up on different KPIs.
    In the Info Cube, I have transactional data on daily basis per “subteam”. I have to show the actual and target values.
    I have created an Info Set using Target DSO and Daily operational cube, so that I should able to compare the target and actual values of KPIs, for all the “subteam” values (From DSO, irrespective of whether the data is available in cube for those sub team).
    I have used Outer Left Join in the Info set (DSO on left side), but I am unable to see the desired results. It is working just like an inner join.
    Any Idea why the Outer Left Join is not working? The DSO has only one fey field called “subteam” on which I have set outer left join.
    Regards,
    Amit

    Hi,
    did you solve your problem? because I have the same issue right now: the left outer join doesn't seem to do its job.
    Let me know if you have found a solution, it would be appreciated.
    have a nice day,
    Dominic

  • Left Outer Join not working in Infoset.

    Hello Friends,
    I have two ODSes , one for planned data (zplan) and other is billing z ods (zsd_o03).
    now the situation is such that in my planned ODS  for one sold to party .
    SOLD TO        MATERRIAL CALMONT     PLANNED QUANTIY
    14315            100                06.2007           54
    14315            200                06.2007           20
    14315            300                06.2007           30
    14315            400                06.2007           10
    But in my Billing ODS iam having for Sold to 14315
    SOLD TO        MATERRIAL CALMONT     ACTUAL QUANTIY
    14315           100           06.2007                  20
    14315           200           06.2007                  30
    And my Bex ouput should be like
    SOLD TO        MATERIAL CALMONT        planned             ACTUAL QUANTIY
    14315            100                06.2007           54                                 20
    14315            200                06.2007           20                                30
    14315            300                06.2007           30                                  0
    14315            400                06.2007           10                                0
    So for this i made one Infoset and these ODses are linked by Sold_to , Materail,
    Calmonth.
    First i tried using Inner joing option , but the bottom two lines were not ciming , so used left outer join , and activated and recreated the query but still its showiong me the output same as inner join .. i.e
    14315            100                06.2007           54                                 20
    14315            200                06.2007           20                                30
    So i checked by writing a ABAP code in Se38 , but there its showing me the correct result ..
    So please anybody help me out because iam thinking that infoset is the right way to do this kind of reporting , or esle shall i make one ODS and populate it through this ABAP code..
    Thanks in advance.

    Hi , can anybody help me in this regard..
    Thanks ..

  • Outer Join not giving correct result

    I have two tables=> tab_child_tmp (product_id,region,child_val,mst_product) and
    tab_master_tmp (master_product_id,region,master_val)
    tab_child_tmp.mst_product is the foreign key referencing tab_master_tmp.master_product_id.
    Currently the tables are populated with below values
    tab_child_tmp
    PRODUCT_ID REGION CHILD_VAL MST_PRODUCT
    Arm-01,     CAL,     100,     Arm-Master
    Arm-01,     DEL,     222,     Arm-Master
    Arm-01,     CHEN,     55,     Arm-Master
    Arm-02,     MUM,     69,     Arm-Master
    Arm-02,     DEL,     90,     Arm-Master
    tab_master_tmp
    MST_PRODUCT     REGION     MASTER_VAL
    Arm-Master     , CAL,     390
    Arm-Master     , DEL,     300
    Arm-Master, CHEN,     450
    Arm-Master, MUM,     600
    Now I want to display the result in the below format
    PRODUCT_ID REGION CHILD_VAL MASTER_VAL
    1. Arm-01     , CAL, 100,     390
    2. Arm-01     , DEL, 222,     300
    3. Arm-01     , CHEN, 55,     450
    4. Arm-01     , MUM, 0,     600
    5. Arm-02     , MUM, 69,     600
    6. Arm-02     , DEL, 90,     300
    7. Arm-02     , CHEN, 0,     450
    8. Arm-02     , CAL, 0,     390
    When I am running the below query it is not returning the above 4,7 and 8 rows. Can you please provide the correct sql to get the above desired output
    SELECT
    a.product_id,
    nvl(a.region,b.region) geo,
    nvl(a.child_val,0)match_val,
    b.master_val
    FROM
    tab_child_tmp a,
    tab_master_tmp b
    WHERE
    a.mst_product(+) = b.master_product AND
    a.region(+) = b.region
    Thanks

    Hi
    Thanks for the reply. Please find below the details.
    Oracle Version*
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
    PL/SQL Release 10.2.0.1.0 - Production
    CORE     10.2.0.1.0     Production
    TNS for Solaris: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Create Table Script_
    create table TAB_CHILD_TMP
    PRODUCT_ID VARCHAR2(50),
    REGION VARCHAR2(100),
    CHILD_VAL NUMBER,
    MST_PRODUCT VARCHAR2(50)
    create table TAB_MASTER_TMP
    MST_PRODUCT VARCHAR2(50),
    REGION VARCHAR2(100),
    MASTER_VAL NUMBER
    Insert Script_
    INSERT INTO tab_child_tmp VALUES ('Arm-01','CAL',100,'Arm-Master');
    INSERT INTO tab_child_tmp VALUES ('Arm-01','DEL',222,'Arm-Master');
    INSERT INTO tab_child_tmp VALUES ('Arm-01','CHEN',55,'Arm-Master');
    INSERT INTO tab_child_tmp VALUES ('Arm-Master','MUM',69,'PLC1');
    INSERT INTO tab_child_tmp VALUES ('Arm-Master','DEL',90,'PLC1');
    INSERT INTO tab_master_tmp VALUES ('Arm-Master','CAL',390);
    INSERT INTO tab_master_tmp VALUES ('Arm-Master','DEL',300);
    INSERT INTO tab_master_tmp VALUES ('Arm-Master','CHEN',450);
    INSERT INTO tab_master_tmp VALUES ('Arm-Master','MUM',600);
    INSERT INTO tab_master_tmp VALUES ('PLC1','MUM',199);
    INSERT INTO tab_master_tmp VALUES ('PLC1','DEL',299);
    INSERT INTO tab_master_tmp VALUES ('PLC1','CHEN',399);
    Expected output logic*
    Need to display the product value for each region along with the value of master product for the corresponding product and region. If a product doesn't belong to a particular region, but the corresponding master product is, then that value also needs to be displayed for that product and region with child value as zero.
    ie. for product Arm-01 there is no record in tab_child_tmp for region "MUM", but it's master product 'Arm-Master' has a record for region 'MUM' in tab master_tmp table. So in ouput there will be a record for product 'Arm-01' and region-'MUM' with child value as 0 and master value as 600.
    Expected Output*
    PRODUCT_ID ~~~ REG ~~~ CHILD_VAL ~~~ MASTER_VAL
    Arm-01 ~~~ CAL ~~~ 100 ~~~ 390
    Arm-01 ~~~ DEL ~~~ 222 ~~~ 300
    Arm-01 ~~~ CHEN ~~~ 55 ~~~ 450
    Arm-01 ~~~ MUM ~~~ 0 ~~~ 600
    Arm-MASTER ~~~ MUM ~~~ 69 ~~~ 199
    Arm-MASTER ~~~ DEL ~~~ 90 ~~~ 299
    Arm-MASTER ~~~ CHEN ~~~ 0 ~~~ 399
    Please help

Maybe you are looking for

  • Messages on Mac app not displaying contact name

    On Messages on my Mac, despite being synced up with iCloud, the Messages app does not display the contact names of anyone. It shows their phone numbers or Apple email addresses. Is there any preference I can change to make it show the contact names?

  • Battery recall program

    We have some batteries with the batteries error (see http://www-307.ibm.com/pc/support/site.wss/document.do?sitestyle=lenovo&lndocid=BATT-LENOVO). We have recalled the affected batteries and get a confirmation number that was in November 2007. Since

  • Error when attempting to install Windows SDK 7.1

    I have not been able to install Windows SDK 7.1 (the machine runs Win 7 Pro x64). The error message shows up in a message box as: "SDKSetup encountered an error: Input string was not in a correct format." By browsing to my %TEMP% directory, I find lo

  • Trap string output from resultset and pass the value to getSchema.

    I want to get the string ldb output frm the resultset and pass it to getSchemas(ldb).kindly let me know how to do it,right now it is throwing error like variable ldb might not have been initialised. public boolean Err_getSchemas() { boolean ret = tru

  • OEDQ - Java Heap errors - thoughts?

    I came across a rather annoying problem while trying to load data into OEDQ today and wondered if anyone can offer any insight. 2 separate installations (OEDQ 9.0.5) trying to load 2 different data loads (120k records and 35k records) both produced j