Outer join two tables with query search record attached to both tables

When I create a query with two tables that have query search records attached with outer join, PS seems to do a natural join (cartesian). We are on PT8.48.
Is there a workaround for this issue. I do not want to remove query search record on either of the tables.
I am trying to create an Emergency contact report. I am using two tables PS_EMPLOYEES and PS_EMERGENCY_CNTCT. Here is the sql PeopleSoft query generated when I did Left outer Join.
Query SQL:
SELECT A.EMPLID, A.NAME, A.ADDRESS1, A.CITY, B.PRIMARY_CONTACT, B.ADDRESS1, B.CITY, B.STATE, B.POSTAL, B.RELATIONSHIP, A.DEPTID, A.JOBCODE, A.COMPANY, A.EMPL_TYPE
FROM (PS_EMPLOYEES A LEFT OUTER JOIN PS_EMERGENCY_CNTCT B ON A.EMPLID = B.EMPLID ), PS_EMPLMT_SRCH_QRY A1, PS_PERS_SRCH_QRY B1
WHERE A.EMPLID = A1.EMPLID
AND A.EMPL_RCD = A1.EMPL_RCD
AND A1.OPRID = 'SREESR'
AND (B.EMPLID = B1.EMPLID OR B.EMPLID IS NULL )
AND B1.OPRID = 'PS'
Appreciate any help.

I think there are fixes for this issue in later tools releases (Report ID 1544345000). I'm not sure about 8.48, but you might try the workaround documented in
E-QR: Left Outer Joins with Security Records are returning unexpected results [ID 651252.1]
on Oracle Support.
Regards,
Bob

Similar Messages

  • How to search records in a standard table with * ?

    Hi everyone,
    Can anyone tell me how to search records in a standard table with * ?
    That is, in screen if user type * abc * for searching the records in which the field MC_STEXT contains 'abc'. What the code should be? How to complete the code below?
      SELECT SINGLE objid FROM p1000  INTO p1000-objid,
      WHERE MC_STEXT = ? .
    Thanks!

    Hi
    There are several way to do that, probably just as some guys wrote the easier way is to use LIKE in WHERE condition and the sign % instead of *:
    V_STRING = '%ABC%'.
    SELECT SINGLE objid FROM p1000 INTO p1000-objid,
    WHERE MC_STEXT LIKE V_STRING.
    U can also use a range (just like select-options):
    RANGES: R_MC FOR P1000-MC_STEXT.
    R_MC-LOW = 'ABC'.
    R_MC(3) = 'ICP'.
    APPEND R_MC.
    SELECT SINGLE objid FROM p1000 INTO p1000-objid,
    WHERE MC_STEXT IN R_MC.
    Max

  • Multiple left outer join in single select query

    My client requires to apply multiple left outer join in single select query.
    Tell me how it is possible . tell me if we can use native sql query.

    HI vineet,
    Using multile left join is possible but it reduce performance as it takes a long time to retrieve data.
    The following code would help you in knowing how to use multiple left join
    REPORT  test.
    PARAMETERS:
      p_auart LIKE vbak-auart.
    DATA:
      BEGIN OF fs_sales,
        auart LIKE vbak-auart,
        vbeln LIKE vbak-vbeln,
        posnr LIKE vbap-posnr,
        matnr LIKE vbap-matnr,
        netwr LIKE vbap-netwr,
      END OF fs_sales,
      fs_temp LIKE fs_sales.
    DATA:
      t_sales LIKE STANDARD TABLE OF fs_sales.
    SELECT k~auart
           k~vbeln
           p~posnr
           p~matnr
           p~netwr
      INTO TABLE t_sales
      FROM vbak AS k
      OUTER JOIN vbap AS p
      ON k~vbeln = p~vbeln
    WHERE auart = p_auart
       AND p~netwr LT 1000.
    IF sy-subrc EQ 0.
      WRITE:/5 'Sales Document'(001),/,
            15 'Sales Document Item'(002),
            40 'Material Number'(003).
      sort t_sales by netwr ascending.
      LOOP AT t_sales INTO fs_sales.
        WRITE:/ fs_sales-vbeln under text-001.
        LOOP AT t_sales INTO fs_temp WHERE vbeln = fs_sales-vbeln.
          WRITE:/ fs_temp-posnr under text-002,
                  fs_temp-matnr under text-003.
        ENDLOOP.
      ENDLOOP.
    ELSE.
      MESSAGE 'No Record Found' TYPE 'I'.
    ENDIF.
    But i would suggest you to go with views instead of using multiple joins..
    Best of luck,
    Bhumika

  • Joining two queries with Visual Composer

    Hallo,
    I was working with visual composer to join two queries with the distinct operator. But on my table view, when i linked it with the distinct operator, i get only the key element customer (customer, customer_ext_key, customer_key). These are the queries that i want join:
    Query 1:
    Customer
    Net Sales
    Query 2:
    Customer
    Billed Quantity
    What i want to see is the following result:
    Customer
    Net Sales
    Billed Quantity
    Can anybody help me with this problem?
    Greeting,
    Murat.

    Hallo,
    I was working with visual composer to join two queries with the distinct operator. But on my table view, when i linked it with the distinct operator, i get only the key element customer (customer, customer_ext_key, customer_key). These are the queries that i want join:
    Query 1:
    Customer
    Net Sales
    Query 2:
    Customer
    Billed Quantity
    What i want to see is the following result:
    Customer
    Net Sales
    Billed Quantity
    Can anybody help me with this problem?
    Greeting,
    Murat.

  • How to get the table with no. of records after filter in webdynpro

    Dear Gurus,
    How to get the table with no. of records after filter in webdynpro?
    Thanks in advance.
    Sankar

    Hello Sankar,
    Please explain your requirement clearly so that we can help you easily.
    To get the table records from your context node use method get_static_attributes_table()
    data lo_nd_mynode       type ref to if_wd_context_node. 
    data lt_atrributes_table  type wd_this->elements_mynode. 
    lo_nd_mynode = wd_context->get_child_node( name = wd_this->wdctx_mynode ). 
    lo_nd_mynode->get_static_attributes_table( importing table = lt_atrributes_table ). 
    Note: You should have already defined your context node as a Dictionary Structure.
    BR,
    RAM

  • All Custom tables (with no. of records) under a package

    Hi All,
    I am trying to get all the custom tables or Ztables under a custom package along with number of records in each custom table.
    I have checked the View INFO_TABL and got all the custom tables under a custom package but did not get number of records for each custom table.
    Is there any other View, Table, Function Module etc., form where I can get the above data. Report is not a option.
    Regs
    Dep

    You may have a look into the program RSTABLESIZE & also the fm DB_STATISTICS_DATA_READ
    Good discussions are available here Most efficient method of finding COUNT of records in client-independent tab & dbtable count

  • Join two tables with no matching records

    Hi All,
    I have two tables which have got data as below. Now I need to join those two tables but there are no matching rows or columns in those tables. I have used OUTER JOIN but query was taking more than 5 mnts to run. Whats the best way to join two tables where
    there are no matching records.
    Table : Sections &Table : orders 
    I am expecting the final output like I have mentioned below.
    How can i write a JOIN. Note there are no matching records from both the tables.
    Pls.This is a very urgent requirement.Regards
    -pep

    Thanks Elrand. I have one question. What if I want to add 10 more parameters in @Section table then
    the logic I have written below will not work. I will have to make it dynamic. Any suggestions.?
    declare @test table (RowNo INT,CokeType NVARCHAR(MAX),BeginUsage dateTIME)
    declare @Section table (SectionName NVARCHAR(100))
    insert into @Section values ('CokeType')
    insert into @Section values ('BeginUsage')
    insert into @test values (1,'OMV - 02E (04/2012)','01-02-2014')
    insert into @test values (2,'OMV - 02E (04/2012)','01-03-2014')
    insert into @test values (3,'PCIC - 01 (01E/2013)','01-04-2014')
    insert into @test values (4,'PCIC - 01 (01E/2013)','01-05-2014')
    insert into @test values (5,'PCIC - 01 (E) - 07/2011 & Alba /2010 (C/F) 05/2011','01-06-2014')
    select * from @Section
    select * from @test
    SELECT
    RowNo,SectionName,
    CASE
    WHEN(SectionName = 'CokeType') THEN CokeType
    ELSE
    CAST (BeginUsage AS VARCHAR(MAX))
    END
    AS DATA
    FROM @Section AS S
    CROSS APPLY
    (SELECT T.RowNo,T.CokeType,T.BeginUsage FROM @test T) P
    ORDER BY SectionName DESC

  • Outer join two tables with two keys

    Hi,
    I have a question regard outer join,
    I have table A (Aid, ADesc), Table B(Bid, Bdesc), and Table C (Aid, Bid, Cdesc)
    There is data in Table A and B, but Table C is empty
    I want to outer join C with A and B with below query
    select ADesc,Bdesc, Cdest
    from A, B, C
    where A.Aid=C.Aid(+) and B.Bid(+)=C.Bid
    and A.Aid='XXX' and B.Bid(+)='ZZZ'
    The query result show only data in column Adesc , but column BDesc is empty even though there are some data in table B.
    How should the query been modified to correctly show ADESC and Bdesc.
    Thanks
    Vincent

    Guess the below should work:
    Case when records are available in Table C:
    with a as
    (select 'XXX' aid, 'adesc' adesc from dual),
    b as
    (select 'ZZZ' bid, 'bdesc' bdesc from dual),
    c as
    (select 'XXX' aid, 'ZZZ' bid, 'cdest' cdest from dual where 1 = 1)
    select ADesc,Bdesc, C1.Cdest
    from
    A LEFT OUTER JOIN C c1 ON (A.AID = C1.AID AND A.AID = 'XXX'),
    B LEFT OUTER JOIN C C2 ON (B.BID = C2.BID AND B.BID = 'ZZZ');
    Output:
    "ADESC"     "BDESC"     "CDEST"
    "adesc"     "bdesc"     "cdest"Case when table C is empty:
    with a as
    (select 'XXX' aid, 'adesc' adesc from dual),
    b as
    (select 'ZZZ' bid, 'bdesc' bdesc from dual),
    c as
    (select 'XXX' aid, 'ZZZ' bid, 'cdest' cdest from dual where 1 = 2)
    select ADesc,Bdesc, C1.Cdest
    from
    A LEFT OUTER JOIN C c1 ON (A.AID = C1.AID AND A.AID = 'XXX'),
    B LEFT OUTER JOIN C C2 ON (B.BID = C2.BID AND B.BID = 'ZZZ');
    "ADESC"     "BDESC"     "CDEST"
    "adesc"     "bdesc"     ""

  • Outer Join Two tables

    I got two Tables.APPROVAL_ROUTING_TAB and doc_issue_tab where APPROVAL_ROUTING_TAB has more rows. I need to do the join two tables such that All the rows in APPROVAL_ROUTING_TAB should be displayed ( more rows) but still connect with the doc_issue_tab. I did an outer join syntax failed.
    What is the correct syntax for this.
    Key_ref takes the following pattern "DOC_CLASS=PR_CLASS_1^DOC_NO=1000007^DOC_REV=A3^DOC_SHEET=1^"
    SELECT
    ar.line_no LINE_NO,
    ar.step_no STEP_NO,
    ar.lu_name LU_NAME,
    ar.key_ref KEY_REF,
    ar.description DESCRIPTION,
    di.status STATUS
    FROM APPROVAL_ROUTING_TAB ar, doc_issue_tab di
    WHERE
    ar.key_ref = 'DOC_CLASS='||di.doc_class||'^DOC_NO='||di.doc_no||'^DOC_REV='||di.doc_rev||'^DOC_SHEET='||di.doc_sheet||'^') (+)
    Thansk in advance
    Prash

    Other options include:
    with t1 as (select 1 id, 'd1=fred^d2=john^d3=bob^' col2 from dual union all
                select 1 id, 'd1=fred^d2=john^d3=george' col2 from dual),
         t2 as (select 'fred' d1, 'john' d2, 'bob' d3 from dual union all
                select 'jim' d1, 'john' d2, 'bob' d3 from dual)
    select *
    from   t1, (select t2.*, 'd1='||d1||'^d2='||d2||'^d3='||d3||'^' full_col
                from t2) t3
    where  t1.col2 = t3.full_col (+);
            ID COL2                      D1   D2   D3  FULL_COL              
             1 d1=fred^d2=john^d3=bob^   fred john bob d1=fred^d2=john^d3=bob^
             1 d1=fred^d2=john^d3=george                                     
    with t1 as (select 1 id, 'd1=fred^d2=john^d3=bob^' col2 from dual union all
                select 1 id, 'd1=fred^d2=john^d3=george' col2 from dual),
         t2 as (select 'fred' d1, 'john' d2, 'bob' d3 from dual union all
                select 'jim' d1, 'john' d2, 'bob' d3 from dual)
    select *
    from   t1 left outer join t2 on (t1.col2 = 'd1='||d1||'^d2='||d2||'^d3='||d3||'^');
            ID COL2                      D1   D2   D3
             1 d1=fred^d2=john^d3=bob^   fred john bob
             1 d1=fred^d2=john^d3=george             

  • Join two list with condition using caml query in SharePoint 2013 with client object model

    Hi,
    Want to join two list to get all fields from both list.
    Am new to sharepoint and sharepoint 2013. Am working in sharepoint 2013 online apps. Am using context.executeQueryasync to load list and get items from list. Am able to get items from single list with caml query, but not able to get both list field values
    with joins.  I did lot of surfing..but not..
    Below is my code..
    ListName1 : "AssignedTasks"
    ListName2 : "Tasks"
     var assignedQueryTest = "<View><Joins><Join Type='INNER' ListAlias='Tasks'><Eq><FieldRef Name='TaskId' RefType='Id'/><FieldRef List='Tasks' Name='ID' /></Eq></Join></Joins>"
                    + "<ViewFields><FieldRef Name='TitleValue' /><FieldRef Name='ActionItemsValue' /></ViewFields>"
                    + "<ProjectedFields>"
                    + "<Field Name='TitleValue' Type='Lookup' List='Tasks' ShowField='Title' /><Field Name='ActionItemsValue' Type='Lookup' List='Tasks' ShowField='ActionItems' />"
                    + "</ProjectedFields>"
                    + "</View>";
                   var web = context.get_web();
                    var list = web.get_lists().getByTitle("AssingedTasks");
                    var myQuery = new SP.CamlQuery();
                    myQuery.set_viewXml(assignedQueryTest);
                    var myItems = list.getItems(myQuery, "Include(TitleValue,ActionItemsValue)");
                    context.load(myItems);
                    context.executeQueryAsync(function () { if(myItems.get_count()>0){....}
    }, errorCallback);
    Here am able to get "AssignedTasks" list field values but not able to get "Tasks" list field values. 
    Can you please help me to resolve the issue. Or new idea for join. I have add the condition also in the query.
    If anybody have good sample, please provide.
    Thanks,
    Pariventhan
    Pariventhan.S

    Hi Pariventhan,
    I don't know about join but I have a workaround of this problem.
    Declare one variable (itemcollection) globally. Load all the items "AssignedTasks" using context.load.
    In the success method call another CAML query using <IN> tag of the ID of the items from the second list (Assuming you have look-up column of the ID of the first list to the second list).
    If this is not clear to you then please let me know. If possible then I can provide code sample.
    Thanks,
    Aniruddha

  • Like % in a query running on an Oracle Apps table with 8 million records

    I am running the below query. As per the explain plan it is using the index on organization_id and inventory_item_id.
    select segment1 from mtl_system_items where organization_id = 100 and inventory_item_id like '123456%'
    It takes about 15 min to run this query which is a long time as this query returns values to the frontend created in asp. The webpage would time out by the time this query completes running. do you have any suggestions on how to run this query faster?

    It is an oracle apps table. below is the structure -
    Name Null? Type
    INVENTORY_ITEM_ID NOT NULL NUMBER
    ORGANIZATION_ID NOT NULL NUMBER
    LAST_UPDATE_DATE NOT NULL DATE
    LAST_UPDATED_BY NOT NULL NUMBER
    CREATION_DATE NOT NULL DATE
    CREATED_BY NOT NULL NUMBER
    LAST_UPDATE_LOGIN NUMBER
    SUMMARY_FLAG NOT NULL VARCHAR2(1)
    ENABLED_FLAG NOT NULL VARCHAR2(1)
    START_DATE_ACTIVE DATE
    END_DATE_ACTIVE DATE
    DESCRIPTION VARCHAR2(240)
    BUYER_ID NUMBER(9)
    ACCOUNTING_RULE_ID NUMBER
    INVOICING_RULE_ID NUMBER
    SEGMENT1 VARCHAR2(40)
    SEGMENT2 VARCHAR2(40)
    SEGMENT3 VARCHAR2(40)
    SEGMENT4 VARCHAR2(40)
    SEGMENT5 VARCHAR2(40)
    SEGMENT6 VARCHAR2(40)
    SEGMENT7 VARCHAR2(40)
    SEGMENT8 VARCHAR2(40)
    SEGMENT9 VARCHAR2(40)
    SEGMENT10 VARCHAR2(40)
    SEGMENT11 VARCHAR2(40)
    SEGMENT12 VARCHAR2(40)
    SEGMENT13 VARCHAR2(40)
    SEGMENT14 VARCHAR2(40)
    SEGMENT15 VARCHAR2(40)
    SEGMENT16 VARCHAR2(40)
    SEGMENT17 VARCHAR2(40)
    SEGMENT18 VARCHAR2(40)
    SEGMENT19 VARCHAR2(40)
    SEGMENT20 VARCHAR2(40)
    ATTRIBUTE_CATEGORY VARCHAR2(30)
    ATTRIBUTE1 VARCHAR2(150)
    ATTRIBUTE2 VARCHAR2(150)
    ATTRIBUTE3 VARCHAR2(150)
    ATTRIBUTE4 VARCHAR2(150)
    ATTRIBUTE5 VARCHAR2(150)
    ATTRIBUTE6 VARCHAR2(150)
    ATTRIBUTE7 VARCHAR2(150)
    ATTRIBUTE8 VARCHAR2(150)
    ATTRIBUTE9 VARCHAR2(150)
    ATTRIBUTE10 VARCHAR2(150)
    ATTRIBUTE11 VARCHAR2(150)
    ATTRIBUTE12 VARCHAR2(150)
    ATTRIBUTE13 VARCHAR2(150)
    ATTRIBUTE14 VARCHAR2(150)
    ATTRIBUTE15 VARCHAR2(150)
    PURCHASING_ITEM_FLAG NOT NULL VARCHAR2(1)
    SHIPPABLE_ITEM_FLAG NOT NULL VARCHAR2(1)
    CUSTOMER_ORDER_FLAG NOT NULL VARCHAR2(1)
    INTERNAL_ORDER_FLAG NOT NULL VARCHAR2(1)
    SERVICE_ITEM_FLAG NOT NULL VARCHAR2(1)
    INVENTORY_ITEM_FLAG NOT NULL VARCHAR2(1)
    ENG_ITEM_FLAG NOT NULL VARCHAR2(1)
    INVENTORY_ASSET_FLAG NOT NULL VARCHAR2(1)
    PURCHASING_ENABLED_FLAG NOT NULL VARCHAR2(1)
    CUSTOMER_ORDER_ENABLED_FLAG NOT NULL VARCHAR2(1)
    INTERNAL_ORDER_ENABLED_FLAG NOT NULL VARCHAR2(1)
    SO_TRANSACTIONS_FLAG NOT NULL VARCHAR2(1)
    MTL_TRANSACTIONS_ENABLED_FLAG NOT NULL VARCHAR2(1)
    STOCK_ENABLED_FLAG NOT NULL VARCHAR2(1)
    BOM_ENABLED_FLAG NOT NULL VARCHAR2(1)
    BUILD_IN_WIP_FLAG NOT NULL VARCHAR2(1)
    REVISION_QTY_CONTROL_CODE NUMBER
    ITEM_CATALOG_GROUP_ID NUMBER
    CATALOG_STATUS_FLAG VARCHAR2(1)
    RETURNABLE_FLAG VARCHAR2(1)
    DEFAULT_SHIPPING_ORG NUMBER
    COLLATERAL_FLAG VARCHAR2(1)
    TAXABLE_FLAG VARCHAR2(1)
    QTY_RCV_EXCEPTION_CODE VARCHAR2(25)
    ALLOW_ITEM_DESC_UPDATE_FLAG VARCHAR2(1)
    INSPECTION_REQUIRED_FLAG VARCHAR2(1)
    RECEIPT_REQUIRED_FLAG VARCHAR2(1)
    MARKET_PRICE NUMBER
    HAZARD_CLASS_ID NUMBER
    RFQ_REQUIRED_FLAG VARCHAR2(1)
    QTY_RCV_TOLERANCE NUMBER
    LIST_PRICE_PER_UNIT NUMBER
    UN_NUMBER_ID NUMBER
    PRICE_TOLERANCE_PERCENT NUMBER
    ASSET_CATEGORY_ID NUMBER
    ROUNDING_FACTOR NUMBER
    UNIT_OF_ISSUE VARCHAR2(25)
    ENFORCE_SHIP_TO_LOCATION_CODE VARCHAR2(25)
    ALLOW_SUBSTITUTE_RECEIPTS_FLAG VARCHAR2(1)
    ALLOW_UNORDERED_RECEIPTS_FLAG VARCHAR2(1)
    ALLOW_EXPRESS_DELIVERY_FLAG VARCHAR2(1)
    DAYS_EARLY_RECEIPT_ALLOWED NUMBER
    DAYS_LATE_RECEIPT_ALLOWED NUMBER
    RECEIPT_DAYS_EXCEPTION_CODE VARCHAR2(25)
    RECEIVING_ROUTING_ID NUMBER
    INVOICE_CLOSE_TOLERANCE NUMBER
    RECEIVE_CLOSE_TOLERANCE NUMBER
    AUTO_LOT_ALPHA_PREFIX VARCHAR2(30)
    START_AUTO_LOT_NUMBER VARCHAR2(30)
    LOT_CONTROL_CODE NUMBER
    SHELF_LIFE_CODE NUMBER
    SHELF_LIFE_DAYS NUMBER
    SERIAL_NUMBER_CONTROL_CODE NUMBER
    START_AUTO_SERIAL_NUMBER VARCHAR2(30)
    AUTO_SERIAL_ALPHA_PREFIX VARCHAR2(30)
    SOURCE_TYPE NUMBER
    SOURCE_ORGANIZATION_ID NUMBER
    SOURCE_SUBINVENTORY VARCHAR2(10)
    EXPENSE_ACCOUNT NUMBER
    ENCUMBRANCE_ACCOUNT NUMBER
    RESTRICT_SUBINVENTORIES_CODE NUMBER
    UNIT_WEIGHT NUMBER
    WEIGHT_UOM_CODE VARCHAR2(3)
    VOLUME_UOM_CODE VARCHAR2(3)
    UNIT_VOLUME NUMBER
    RESTRICT_LOCATORS_CODE NUMBER
    LOCATION_CONTROL_CODE NUMBER
    SHRINKAGE_RATE NUMBER
    ACCEPTABLE_EARLY_DAYS NUMBER
    PLANNING_TIME_FENCE_CODE NUMBER
    DEMAND_TIME_FENCE_CODE NUMBER
    LEAD_TIME_LOT_SIZE NUMBER
    STD_LOT_SIZE NUMBER
    CUM_MANUFACTURING_LEAD_TIME NUMBER
    OVERRUN_PERCENTAGE NUMBER
    MRP_CALCULATE_ATP_FLAG VARCHAR2(1)
    ACCEPTABLE_RATE_INCREASE NUMBER
    ACCEPTABLE_RATE_DECREASE NUMBER
    CUMULATIVE_TOTAL_LEAD_TIME NUMBER
    PLANNING_TIME_FENCE_DAYS NUMBER
    DEMAND_TIME_FENCE_DAYS NUMBER
    END_ASSEMBLY_PEGGING_FLAG VARCHAR2(1)
    REPETITIVE_PLANNING_FLAG VARCHAR2(1)
    PLANNING_EXCEPTION_SET VARCHAR2(10)
    BOM_ITEM_TYPE NOT NULL NUMBER
    PICK_COMPONENTS_FLAG NOT NULL VARCHAR2(1)
    REPLENISH_TO_ORDER_FLAG NOT NULL VARCHAR2(1)
    BASE_ITEM_ID NUMBER
    ATP_COMPONENTS_FLAG NOT NULL VARCHAR2(1)
    ATP_FLAG NOT NULL VARCHAR2(1)
    FIXED_LEAD_TIME NUMBER
    VARIABLE_LEAD_TIME NUMBER
    WIP_SUPPLY_LOCATOR_ID NUMBER
    WIP_SUPPLY_TYPE NUMBER
    WIP_SUPPLY_SUBINVENTORY VARCHAR2(10)
    PRIMARY_UOM_CODE VARCHAR2(3)
    PRIMARY_UNIT_OF_MEASURE VARCHAR2(25)
    ALLOWED_UNITS_LOOKUP_CODE NUMBER
    COST_OF_SALES_ACCOUNT NUMBER
    SALES_ACCOUNT NUMBER
    DEFAULT_INCLUDE_IN_ROLLUP_FLAG VARCHAR2(1)
    INVENTORY_ITEM_STATUS_CODE VARCHAR2(10)
    INVENTORY_PLANNING_CODE NUMBER
    PLANNER_CODE VARCHAR2(10)
    PLANNING_MAKE_BUY_CODE NUMBER
    FIXED_LOT_MULTIPLIER NUMBER
    ROUNDING_CONTROL_TYPE NUMBER
    CARRYING_COST NUMBER
    POSTPROCESSING_LEAD_TIME NUMBER
    PREPROCESSING_LEAD_TIME NUMBER
    FULL_LEAD_TIME NUMBER
    ORDER_COST NUMBER
    MRP_SAFETY_STOCK_PERCENT NUMBER
    MRP_SAFETY_STOCK_CODE NUMBER
    MIN_MINMAX_QUANTITY NUMBER
    MAX_MINMAX_QUANTITY NUMBER
    MINIMUM_ORDER_QUANTITY NUMBER
    FIXED_ORDER_QUANTITY NUMBER
    FIXED_DAYS_SUPPLY NUMBER
    MAXIMUM_ORDER_QUANTITY NUMBER
    ATP_RULE_ID NUMBER
    PICKING_RULE_ID NUMBER
    RESERVABLE_TYPE NUMBER
    POSITIVE_MEASUREMENT_ERROR NUMBER
    NEGATIVE_MEASUREMENT_ERROR NUMBER
    ENGINEERING_ECN_CODE VARCHAR2(50)
    ENGINEERING_ITEM_ID NUMBER
    ENGINEERING_DATE DATE
    SERVICE_STARTING_DELAY NUMBER
    VENDOR_WARRANTY_FLAG NOT NULL VARCHAR2(1)
    SERVICEABLE_COMPONENT_FLAG VARCHAR2(1)
    SERVICEABLE_PRODUCT_FLAG NOT NULL VARCHAR2(1)
    BASE_WARRANTY_SERVICE_ID NUMBER
    PAYMENT_TERMS_ID NUMBER
    PREVENTIVE_MAINTENANCE_FLAG VARCHAR2(1)
    PRIMARY_SPECIALIST_ID NUMBER
    SECONDARY_SPECIALIST_ID NUMBER
    SERVICEABLE_ITEM_CLASS_ID NUMBER
    TIME_BILLABLE_FLAG VARCHAR2(1)
    MATERIAL_BILLABLE_FLAG VARCHAR2(30)
    EXPENSE_BILLABLE_FLAG VARCHAR2(1)
    PRORATE_SERVICE_FLAG VARCHAR2(1)
    COVERAGE_SCHEDULE_ID NUMBER
    SERVICE_DURATION_PERIOD_CODE VARCHAR2(10)
    SERVICE_DURATION NUMBER
    WARRANTY_VENDOR_ID NUMBER
    MAX_WARRANTY_AMOUNT NUMBER
    RESPONSE_TIME_PERIOD_CODE VARCHAR2(30)
    RESPONSE_TIME_VALUE NUMBER
    NEW_REVISION_CODE VARCHAR2(30)
    INVOICEABLE_ITEM_FLAG NOT NULL VARCHAR2(1)
    TAX_CODE VARCHAR2(50)
    INVOICE_ENABLED_FLAG NOT NULL VARCHAR2(1)
    MUST_USE_APPROVED_VENDOR_FLAG NOT NULL VARCHAR2(1)
    REQUEST_ID NUMBER
    PROGRAM_APPLICATION_ID NUMBER
    PROGRAM_ID NUMBER
    PROGRAM_UPDATE_DATE DATE
    OUTSIDE_OPERATION_FLAG NOT NULL VARCHAR2(1)
    OUTSIDE_OPERATION_UOM_TYPE VARCHAR2(25)
    SAFETY_STOCK_BUCKET_DAYS NUMBER
    AUTO_REDUCE_MPS NUMBER(22)
    COSTING_ENABLED_FLAG NOT NULL VARCHAR2(1)
    AUTO_CREATED_CONFIG_FLAG NOT NULL VARCHAR2(1)
    CYCLE_COUNT_ENABLED_FLAG NOT NULL VARCHAR2(1)
    ITEM_TYPE VARCHAR2(30)
    MODEL_CONFIG_CLAUSE_NAME VARCHAR2(10)
    SHIP_MODEL_COMPLETE_FLAG VARCHAR2(1)
    MRP_PLANNING_CODE NUMBER
    RETURN_INSPECTION_REQUIREMENT NUMBER
    ATO_FORECAST_CONTROL NUMBER
    RELEASE_TIME_FENCE_CODE NUMBER
    RELEASE_TIME_FENCE_DAYS NUMBER
    CONTAINER_ITEM_FLAG VARCHAR2(1)
    VEHICLE_ITEM_FLAG VARCHAR2(1)
    MAXIMUM_LOAD_WEIGHT NUMBER
    MINIMUM_FILL_PERCENT NUMBER
    CONTAINER_TYPE_CODE VARCHAR2(30)
    INTERNAL_VOLUME NUMBER
    WH_UPDATE_DATE DATE
    PRODUCT_FAMILY_ITEM_ID NUMBER
    GLOBAL_ATTRIBUTE_CATEGORY VARCHAR2(150)
    GLOBAL_ATTRIBUTE1 VARCHAR2(150)
    GLOBAL_ATTRIBUTE2 VARCHAR2(150)
    GLOBAL_ATTRIBUTE3 VARCHAR2(150)
    GLOBAL_ATTRIBUTE4 VARCHAR2(150)
    GLOBAL_ATTRIBUTE5 VARCHAR2(150)
    GLOBAL_ATTRIBUTE6 VARCHAR2(150)
    GLOBAL_ATTRIBUTE7 VARCHAR2(150)
    GLOBAL_ATTRIBUTE8 VARCHAR2(150)
    GLOBAL_ATTRIBUTE9 VARCHAR2(150)
    GLOBAL_ATTRIBUTE10 VARCHAR2(150)
    PURCHASING_TAX_CODE VARCHAR2(50)
    The query is as below
    select segment1 from mtl_system_items where organization_id = 100 and inventory_item_id like '123456%'
    The explain plan is as below -
    Plan
    SELECT STATEMENT RULE          
         2 TABLE ACCESS BY INDEX ROWID INV.MTL_SYSTEM_ITEMS      
              1 INDEX RANGE SCAN NON-UNIQUE INV.MTL_SYSTEM_ITEMS_N1
    The INV.MTL_SYSTEM_ITEMS_N1 index is created on
    ORGANIZATION_ID and SEGMENT1

  • Linking two tables with no duplicated records!

    Hi,
    I have two tables now with both tables is having the common filed matnr.
    now using this field MATNR from  first table ,i need to fetch projectno from the other table which has to be unique.if there are more than one entry found for MATNR in question then that must not be updated to the first table!
    any ideas?
    Raj

    hi raj,
    try this code.
    data:
      ld_count type p,
      ld_tabix type sy-tabix.
    loop at itab1.
      move sy-tabix to ld_tabix.
      ld_count = 0.
      loop at itab2 where matnr eq itab1-matnr.
        add 1 to ld_count.
      endloop.
      if ld_count = 1.
        read table itab2 with key matnr = itab1-matnr.
        move itab2-project to itab1-project.
        modify itab1 index ld_tabix.
      endif.
    endloop.

  • Outer join two different dates

    I have a table that has some pre-aggregated dollar amounts.  Each record also has a date of fill and a file date.  I want to sum all records in the table by year/month of fill date and separately I want to use the same query results to sum by year/month
    of file date.  The problem I was initially having was that the query was not showing all dates January through December, but instead was only showing dates for which there was a record.  Makes sense, I get it, and I fixed that by using a cross join
    on a date table and left join on that table.  See below.  Pretty simple really.  My results have a record for every file date and a $0 amount if there is no file for that date.  However, I want the same thing for fill date.  If I don't
    have a file for January but I do have a fill for that date then I want to display that year/month with the dollar amount.  I hope this makes sense.
    The approaches I have tried thus far are to add a separate CTE for the fill date, joining to the same CTE twice (once for fill and once for file), and some crazy unions... all with no luck.
    Can anyone help me out please?
    Thanks!
    WITH dt
    AS (SELECT cdb.ID,
    cdb.RestoreDBName,
    cdb.DisplayName,
    d.Date
    FROM DataOperations.lkp.Dates AS d CROSS JOIN DataOperations.dbo.vwClientDatabases AS cdb
    WHERE d.Date BETWEEN '01-01-2013' AND DATEADD(day, -1 * DAY(CAST(GETDATE() AS DATE)), DATEADD(month, 1, CAST(GETDATE() AS DATE)))
    AND d.DayOfMonth = 1
    SELECT dtFile.RestoreDBName,
    dtFile.ID,
    YEAR(dtFile.Date) AS FileYear,
    MONTH(dtFile.Date) AS FileMonth,
    dtFile.Date AS FileDate,
    LEFT(CONVERT(VARCHAR, dtFile.Date, 120), 7) AS FileYearMonth,
    YEAR(rx.FillDate) AS FillYear,
    MONTH(rx.FillDate) AS FillMonth,
    CAST(CONVERT(VARCHAR, YEAR(rx.FillDate)) + '-' + CONVERT(VARCHAR, MONTH(rx.FillDate)) + '-01' AS DATE) AS FillDate,
    LEFT(CONVERT(VARCHAR, rx.FillDate, 120), 7) AS FillYearMonth,
    ISNULL(SUM(rx.TotalPayAmount), 0) AS TotalPayAmount
    FROM dt AS dtFile LEFT JOIN DataOperations.rpt.RxGrossPayAmountByDay AS rx ON rx.DBName = dtFile.RestoreDBName
    AND DATEADD(month, DATEDIFF(month, 0, rx.TapeFileDate), 0) = dtFile.
    [Date]
    LEFT JOIN DataOperations.dbo.vwClientDatabases AS cdb ON cdb.RestoreDBName = rx.DBName
    GROUP BY dtFile.RestoreDBName,
    dtFile.ID,
    YEAR(dtFile.Date) ,
    MONTH(dtFile.Date) ,
    dtFile.Date ,
    LEFT(CONVERT(VARCHAR, dtFile.Date, 120), 7) ,
    YEAR(rx.FillDate) ,
    MONTH(rx.FillDate) ,
    CAST(CONVERT(VARCHAR, YEAR(rx.FillDate)) + '-' + CONVERT(VARCHAR, MONTH(rx.FillDate)) + '-01' AS DATE),
    LEFT(CONVERT(VARCHAR, rx.FillDate, 120), 7)
    ORDER BY dtFile.RestoreDBName, YEAR(dtFile.Date), MONTH(dtFile.Date)

    Ok, how about this.
    WITH dtFile
    AS (SELECT dt.RestoreDBName,
    YEAR(dt.Date) AS Year,
    MONTH(dt.Date) AS Month,
    ISNULL(SUM(rx.TotalPayAmount), 0) AS TotalPayAmount
    FROM(
    SELECT cdb.ID,
    cdb.RestoreDBName,
    cdb.DisplayName,
    d.Date
    FROM DataOperations.lkp.Dates AS d CROSS JOIN DataOperations.dbo.vwClientDatabases AS cdb
    WHERE d.Date BETWEEN '01-01-2013' AND DATEADD(day, -1 * DAY(CAST(GETDATE()AS DATE)), DATEADD(month, 1, CAST(GETDATE()AS DATE)))
    AND d.DayOfMonth = 1
    )AS dt LEFT JOIN DataOperations.rpt.RxGrossPayAmountByDay AS rx ON rx.DBName = dt.RestoreDBName
    AND DATEADD(month, DATEDIFF(month,
    0, rx.TapeFileDate), 0) = dt.[Date]
    GROUP BY dt.RestoreDBName,
    YEAR(dt.Date) ,
    MONTH(dt.Date) ),
    dtFill
    AS (SELECT dt.RestoreDBName,
    YEAR(dt.Date) AS Year,
    MONTH(dt.Date) AS Month,
    ISNULL(SUM(rx.TotalPayAmount), 0) AS TotalPayAmount
    FROM(
    SELECT cdb.ID,
    cdb.RestoreDBName,
    cdb.DisplayName,
    d.Date
    FROM DataOperations.lkp.Dates AS d CROSS JOIN DataOperations.dbo.vwClientDatabases AS cdb
    WHERE d.Date BETWEEN '01-01-2013' AND DATEADD(day, -1 * DAY(CAST(GETDATE()AS DATE)), DATEADD(month, 1, CAST(GETDATE()AS DATE)))
    AND d.DayOfMonth = 1
    )AS dt LEFT JOIN DataOperations.rpt.RxGrossPayAmountByDay AS rx ON rx.DBName = dt.RestoreDBName
    AND DATEADD(month, DATEDIFF(month,
    0, rx.FillDate), 0) = dt.[Date]
    GROUP BY dt.RestoreDBName,
    YEAR(dt.Date) ,
    MONTH(dt.Date)
    SELECT dtFile.RestoreDBName,
    dtFile.Year AS FileYear,
    dtFile.Month AS FileMonth,
    dtFill.Year AS FillYear,
    dtFill.Month AS FillMonth,
    dtFile.TotalPayAmount as FileTotalPayAmount,
    dtFill.TotalPayAmount as FillTotalPayAmount
    FROM dtFile FULL OUTER JOIN dtFill ON dtFile.RestoreDBName = dtFill.RestoreDBName
    ORDER BY dtFile.RestoreDBName, dtFile.Year, dtFile.Month
    I think I'm getting close, but there's some odd results for the file total pay amount.  Here are the partial results for the first RestoreDBName in my results.  I have some repeating and I'm not sure what value to use.  Do I use FillTotalPayAmount
    PLUS FileTotalPayAmount or one or the other or what?  Am I joining on the right fields?
    Thank you so much.  This is a big help and a great learning lesson too!
    FileYear
    FileMonth
    FillYear
    FillMonth
     FileTotalPayAmount 
      FillTotalPayAmount 
    2013
    1
    2013
    1
    655.5
    711.7
    2013
    1
    2013
    2
    655.5
    658.5
    2013
    1
    2013
    3
    655.5
    715.2
    2013
    1
    2013
    4
    655.5
    744.5
    2013
    1
    2013
    5
    655.5
    765.8
    2013
    1
    2013
    6
    655.5
    718.8
    2013
    1
    2013
    7
    655.5
    792.8
    2013
    1
    2013
    8
    655.5
    781.4
    2013
    1
    2013
    9
    655.5
    748.6
    2013
    1
    2013
    10
    655.5
    822.4
    2013
    1
    2013
    11
    655.5
    752.2
    2013
    1
    2013
    12
    655.5
    839.0
    2013
    1
    2014
    1
    655.5
    702.9
    2013
    1
    2014
    2
    655.5
    7.3
    2013
    1
    2014
    3
    655.5
    0.0
    2013
    1
    2014
    4
    655.5
    2013
    2
    2013
    1
    672.7
    711.7
    2013
    2
    2013
    2
    672.7
    658.5
    2013
    2
    2013
    3
    672.7
    715.2
    2013
    2
    2013
    4
    672.7
    744.5
    2013
    2
    2013
    5
    672.7
    765.8
    2013
    2
    2013
    6
    672.7
    718.8
    2013
    2
    2013
    7
    672.7
    792.8
    2013
    2
    2013
    8
    672.7
    781.4
    2013
    2
    2013
    9
    672.7
    748.6
    2013
    2
    2013
    10
    672.7
    822.4
    2013
    2
    2013
    11
    672.7
    752.2
    2013
    2
    2013
    12
    672.7
    839.0
    2013
    2
    2014
    1
    672.7
    702.9
    2013
    2
    2014
    2
    672.7
    7.3
    2013
    2
    2014
    3
    672.7
    0.0
    2013
    2
    2014
    4
    672.7
    2013
    3
    2013
    1
    630.6
    711.7
    2013
    3
    2013
    2
    630.6
    658.5
    2013
    3
    2013
    3
    630.6
    715.2

  • ORA-22922: nonexistent LOB value in outer join in XMLDB parsing query

    Hi,
    We are in a situation where i must use outer join with the address type fragment in the XML reader query,
    Here is the oracle installation details
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    PL/SQL Release 11.2.0.3.0 - Production
    "CORE     11.2.0.3.0     Production"
    However once i add the (+) sign i get an error, other wise it runs absolutely fine without the (+) s
    ORA-29400: data cartridge error
    ORA-22922: nonexistent LOB value
    29400. 00000 - "data cartridge error\n%s"
    *Cause:    An error has occurred in a data cartridge external procedure.
    This message will be followed by a second message giving
    more details about the data cartridge error.
    *Action:   See the data cartridge documentation
    for an explanation of the second error message.
    Query:
    =======
    select
    from PWAYWORKFILE_TABLE,
    xmltable(
    xmlnamespaces(DEFAULT 'http://www.cccis.com/Pathways/Workfile'
    , 'http://www.cccis.com/Pathways/CommonType' as "pct")
    , '$XS/PwayWorkfile' passing WORKFILE as "XS"
    columns
    CURESTID VARCHAR2 (4000) PATH 'EstimateComp/LastOutboxEstID',
    Est_Fragment XMLTYPE PATH 'EstimateComp/EstList/VehEstimate'
    ) m,
    XMLTABLE(
    xmlnamespaces(DEFAULT 'http://www.cccis.com/Pathways/Workfile'
    , 'http://www.cccis.com/Pathways/CommonType' as "pct")
    , '$PY/VehEstimate' passing m.Est_Fragment as "PY"
    columns
    NUMBERLINES VARCHAR2 (4000) PATH '@NumberLines',
    LINEESTIMATEID VARCHAR2 (4000) PATH 'EstimateID',
    EstLine_Fragment XMLTYPE PATH 'EstimateLines/EstimateLine'
    ) (+) l,
    XMLTABLE(
    xmlnamespaces(DEFAULT 'http://www.cccis.com/Pathways/Workfile'
    , 'http://www.cccis.com/Pathways/CommonType' as "pct")
    , '$NY/EstimateLine' passing l.EstLine_Fragment as "NY"
    columns
    LINENUMBER VARCHAR2 (4000) PATH '@LineNumber',
    LINEBLOCKID VARCHAR2 (4000) PATH 'LineBlockID',
    LABORCATEGORY VARCHAR2 (4000) PATH 'LaborCategory',
    LABORHOURS VARCHAR2 (4000) PATH 'LaborHours',
    LINEOPERATION VARCHAR2 (4000) PATH 'LineOperation',
    MANUALLABORINCLUDE VARCHAR2 (4000) PATH 'ManualLaborInclude',
    MANUALPAINTINCLUDE VARCHAR2 (4000) PATH 'ManualPaintInclude',
    MANUALPRICEINCLUDE VARCHAR2 (4000) PATH 'ManualPriceInclude',
    OEMPRICE VARCHAR2 (4000) PATH 'Calculation/OEMPrice',
    SINGLEOHINCL VARCHAR2 (4000) PATH 'DataList/DBMotorData/LaborInclType/@SINGLEOHINCL',
    DOUBLEOHINCL VARCHAR2 (4000) PATH 'DataList/DBMotorData/LaborInclType/@DOUBLEOHINCL',
    PPAGEINCL VARCHAR2 (4000) PATH 'DataList/DBMotorData/LaborInclType/@PPAGEINCL',
    SUPPLIERID VARCHAR2 (4000) PATH 'DataList/RPSPart/SupplierID'
    ) (+) j
    where
    l.LINEESTIMATEID = 51 or
    l.LINEESTIMATEID = m.CURESTID or
    l.LINEESTIMATEID = (CASE
    WHEN m.CURESTID = 101 THEN 51
    WHEN m.CURESTID > 101 THEN m.CURESTID -1
    ELSE -1 END);
    Please note that the PWAYWORKFILE_TABLE is objection relationally stored with XMLs.
    Please suggest what kind of error i am getting and what possible steps might resolve the same, let me know if i missed any details which might shade more light on the same.
    Regards,
    Arghyadip

    Which outer join gives you the error? I don't see any address information in the SQL, hence my question. The first outer join, on table alias L is not needed. The WHERE clause you have setup requires that L.LINEESTIMATEID has a value and so NULL will not evaluate to TRUE and the row will be filtered out. This means you will only be returning rows where there exists rows in the L table, hence the outer join is not needed.
    Are all your columns really VARCHAR2(4000)? You say it is object-relational, but was something defined as a CLOB?
    You did not provide much in order to duplicate your error so I am just guessing at causes to identify the error.
    Also see #9 in
    {message:id=9360002}

  • Error in making left outer join to a nested query

    i am writing this query getting error here i am using nested query with that i am making join it is giving error
    SQL
    SELECT
    * FROM IVItem INNER JOIN
    IVPackSize_Mst ON IVItem.PackSizeID = IVPackSize_Mst.Id
    left outer join IvItemGenericLink on IvItemGenericLink.itemID=IVItem.Id
    Select GenericId from
    IvItemGenericLink where ItemID=IVItem.Id and rownum <=1
    )x
    and x on IvItemGenericLink.GenericId=x.GenericId;
    Error report:
    SQL Error: ORA-00936: missing expression
    00936. 00000 - "missing expression"
    *Cause:   
    *Action:
    give me and suggestion

    i am using left outer join at virtual table say x your gave me its equivalent
    EXISTS (SELECT 1 FROM IvItemGenericLink G
    WHERE G.ITEMID =V.ID
    AND G.GenericId = L.GenericId)-----its i guess inner join
    i am not confirmed that why iam asking this i guess i have to use this
    as i use keyword inner join for inner join and for left join i use
    left outer join
    EXISTS (SELECT 1 FROM IvItemGenericLink G
    WHERE G.ITEMID =V.ID
    AND G.GenericId(+) = L.GenericId)-----its i guess left outer join
    left outer join
    Select GenericId from
    IvItemGenericLink where ItemID=IVItem.Id and rownum <=1
    )*x*
    IvItemGenericLink.GenericId=x.GenericId
    -------------------Statement U Gave in this--------------------------------------------------------------------------
    SELECT *
    FROM IVITEM V, IVPACKSIZE_MST M , IVITEMGENERICLINK L,
    WHERE V.PACKSIZEID = M.ID
    AND V.ID = L.ITEMID (+)
    AND EXISTS (SELECT 1 FROM IvItemGenericLink G
    WHERE G.ITEMID =V.ID
    AND G.GenericId = L.GenericId)
    -------------------Statement U Gave in this--------------------------------------------------------------------------
    is this equivalent to left outer join
    *AND EXISTS (
    SELECT 1 FROM IvItemGenericLink G*
    WHERE G.ITEMID =V.ID
    *AND G.GenericId = L.GenericId
    please tell me this in this regard

Maybe you are looking for