Joining temporary and regular tables

Can you create join between a temporary table and a permanent one?  I'm not sure how that would work. 

You can join a temportary table to a permanent table like this:
Specific to SSRS this will not supply a valid dataset in SSRS however.  If you add this as your query in your dataset in your report project:
USE [tempdb]  
CREATE TABLE #temp(  
Col1    INT PRIMARY KEY,  
nm      VARCHAR(100)  
INSERT #temp 
SELECT ContactID,  
       FirstName + ' ' + LastName AS nm  
FROM AdventureWorks.Person.Contact   
SELECT nm,  
       Col1,  
       LoginID  
FROM #temp AS c JOIN 
[AdventureWorks].[HumanResources].[Employee] AS e  
ON c.Col1 = e.[ContactID]  
DROP TABLE #temp 
But if you attempt to use this as a datasource in a report project you will receive an error.
Hope this helps

Similar Messages

  • Join LDB's - Join LDB and a Table

    Hello Dear Experts,
    I would like to know whether it is possible to join 2 or more Logical DB's together or a Logical DB and a Table together through sq02 while creating an infoset.
    I have a case to solve where I need 2 different logical DB's to join for an infoset I want to create & I have also a case where I need to join a logical DB & a Table to join for an infoset I want to create through sq02.
    Really Great Thanks in advance for your valuable help.!
    Kind Regards
    George

    Hi
    Refer these links:
    <u>http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ec84446011d189700000e8322d00/content.htm</u>
    <u>http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm</u>
    <u>http://www.karakas-online.de/forum/viewtopic.php?t=730</u>
    Thanks
    Vasudha
    Message was edited by:
            Vasudha L

  • SQ01 Output From Joining VBSEGK and VBSEGS tables-1 line of output per DOC

    I setup a query using SQ01 which uses tables VBSEGK and VBSEGS ( parked documents).   The VBSEGS table has multiple lines per document in that there are multiple G/L accounts, cost centers and amounts in order to distribute expense acorss multiple cost centers from one vendor's invoice.     When I execute the query only the first line item in the VBSEGS table appears and the remaining lines do not appear.    Any insight to get all line items for each document from the VCSEGS table to appear will be appreciated.

    Hi,
    By default four links will be established between VBSEGK and VBESGS.
    AUSBK
    BELNR
    GJAHR
    BZKEY (This link should be removed for getting all the records)
    However, you get the line items only if documents exist in both the tables.  Apart from that, if two line items in one table and three line items in another table, you will get only three line items in the report.  You need to select fields related to VBSEGK and VBSEGS tables.
    Please provide me more information on your exact requirement.  I can confirm you whether this  is possible by way of query.
    Best Regards,
    Madhu

  • How to join Dimensions and Fact Tables in OBIEE

    Hi All,
    I need to create report which need to get the information from two fact tables and 7 dimensions. The granularity is not same in both the fact tables. One fact table is having common keys between all the dimension tables and second fact table have only two dimension keys but with different names. My requirement is to create the report by taking the measures from both the fact tables.
    I have created joins between the second fact table and two dimension tables in physical and BMM layer and also set the highest level for all other dimension tables in the LTS of second fact table. when am creating report by taking the measures from both the fact tables, data is not getting for the measure which taken from the second fact table. Please advice me how to get the data for the measure which taken from the second fact table.
    Thanks in Advancec !!

    You have to use the level-base measure capabilities.
    http://gerardnico.com/wiki/dat/obiee/bi_server/design/fact_table/level_based_measure_calculations
    For all measures of the second fact table with the lowest grain (with two dimension keys), set for all dimension where you don't have any key the logical level to the "All" or "Total".
    And UNSET the highest level of the LTS for the second fact table.
    Success
    Nico

  • Joining transparent and pool tables.

    Friends,
    I Had to join 7 tables in which 6 are the transparent tables 1 is the pool table. I had declared 3 internal tables one for data from 6  transparent table(JOIN) second for data from pool table third for combining and saving data from both tables into single table. I had written following cide. But its giving errors. I am unable to locate where i made the mistake.
    Also is it possible to join two INTERNAL tables?
    TABLES: EKKO,EKPO,MAKT,LFA1,MSEG,EKET,KONV.
    TYPES: BEGIN OF TAB1,
    BUKRS TYPE EKKO-BUKRS,
    EKORG TYPE EKKO-EKORG,
    BSART TYPE EKKO-BSART,
    LIFNR TYPE EKKO-LIFNR,
    KNUMV TYPE EKKO-KNUMV,
    MATNR TYPE EKPO-MATNR,
    MATKL TYPE EKPO-MATKL,
    WERKS TYPE EKPO-WERKS,
    MENGE TYPE EKPO-MENGE,
    KO_PRCTR TYPE EKPO-KO_PRCTR,
    EINDT TYPE EKET-EINDT,
    MAKTX TYPE MAKT-MAKTX,
    NAME1 TYPE LFA1-NAME1,
      end of TAB1.
      DATA: ITAB1 type table of TAB1,
            WA1 like line of ITAB1.
      TYPES:begin of TAB2,
        KNUMV TYPE KONV-KNUMV,
      KSCHL TYPE KONV-KSCHL,
    KBETR TYPE KONV-KBETR,
    END OF TAB2.
      DATA:ITAB2 type table of TAB2,
            WA2 like line of ITAB2.
    TYPES : BEGIN OF TAB4,
    BUKRS TYPE EKKO-BUKRS,
    EKORG TYPE EKKO-EKORG,
    BSART TYPE EKKO-BSART,
    LIFNR TYPE EKKO-LIFNR,
    MATNR TYPE EKPO-MATNR,
    MATKL TYPE EKPO-MATKL,
    WERKS TYPE EKPO-WERKS,
    MENGE TYPE EKPO-MENGE,
    KO_PRCTR TYPE EKPO-KO_PRCTR,
    EINDT TYPE EKET-EINDT,
    MAKTX TYPE MAKT-MAKTX,
    NAME1 TYPE LFA1-NAME1,
    KSCHL TYPE KONV-KSCHL,
    KBETR TYPE KONV-KBETR,
    END OF TAB4.
    DATA: ITAB4 type table of TAB4,
          WA4 LIKE ITAB4.
    *select a1-bukrs a1 ekorg a1-bsart a1-lifnr b1-matnr b1-matkl b1-werks b1-menge b1-ko_prctr
    c1-eindt d1-maktx e1-name1 f1-menge into corresponding fields of table ITAB up to 50 rows
    from(((((( ekko as a1 INNER JOIN ekpo as b1 on a1ebeln = b1ebeln) inner join eket as c1 on
    a1ebeln = c1ebeln and b1ebelp = c1ebelp) inner join makt as d1 on b1matnr = d1matnr) inner join LFA1 as e1
    on a1lifnr = e1lifnr) inner join mseg as f1 on a1lifnr = f1lifnr and a1ebeln = f1ebeln and b1matnr = f1matnr
    and b1werks = f1werks and b1ebelp = f1ebelp) inner join konv as g1 on a1knumv = g1knumv) .
    select a1bukrs a1ekorg a1bsart a1lifnr b1matnr b1matkl b1werks b1menge b1~ko_prctr
      c1eindt d1maktx e1name1 f1menge into corresponding fields of table ITAB1
      from ((((( ekko as a1 INNER JOIN ekpo as b1 on a1ebeln = b1ebeln) inner join eket as c1 on
      a1ebeln = c1ebeln and b1ebelp = c1ebelp) inner join makt as d1 on b1matnr = d1matnr)
      inner join LFA1 as e1 on a1lifnr = e1lifnr) inner join mseg as f1 on a1lifnr = f1lifnr and a1ebeln = f1ebeln and b1matnr = f1matnr
      and b1werks = f1werks and b1ebelp = f1ebelp).
    *select * from ITAB1 into WA1.
    select KSCHL KBETR KNUMV into  TABLE ITAB2
    from KONV for all entries in ITAB1 where ITAB1-KNUMV  = KNUMV~KNUMV .
      select abukrs aekorg absart alifnr amatnr amatkl awerks amenge ako_prctr aeindt
        amaktx aname1 a~menge
        bkschl bkbetr into corresponding fields of table ITAB4
        from ( ITAB1 as a INNER JOIN ITAB2 as b on aKNUMV = bKNUMV ).
    LOOP AT ITAB4 INTO WA_ITAB.
    WRITE : / WA_ITAB-BUKRS,WA_ITAB-MATNR,WA_ITAB-EINDT,WA_ITAB-MAKTX ,WA_ITAB-NAME1 ,WA_ITAB-KSCHL,
    WA_ITAB-KBETR,WA_ITAB-MENGE.
    ENDLOOP.

    You have too many parentheses in your JOIN condiiton. Your FAE condition is incorrect. And no, you cannot do a JOIN on internal tables.
    Please do an F1 on SELECT.
    Rob

  • Joining OCRD and OCQG tables

    HI all,
    How can i link these two tables?
    OCRD and OCQG?
    Appreciate your advice.
    Thanks!

    Hi,
    By default, join condition exist on these two tables with GroupCode field.
    Regards,
    Vijay Kumar
    SAP Business One Forums Team

  • How to join HR_API_TRANSACTIONS and wf_item_activity_statuses table?

    Hi, please help im having issues joining the following tables:
    im getting muliptiple records, cos a workflow has muliple records.
    i want to show the wfis.activity status (the status that shows in e-business suite - workflow admin)
    is there a join that im missing ??
    select *
    from HR_API_TRANSACTIONS HAT, HR_API_TRANSACTION_STEPS HATS, wf_item_activity_statuses wfis
    where hat.transaction_id = HATS.transaction_id
    and HAT.status IN ('Y','YS')
    and hat.TRANSACTION_REF_TABLE = 'PER_ABSENCE_ATTENDANCES'
    and hat.TRANSACTION_GROUP = 'ABSENCE_MGMT'
    and hat.TRANSACTION_IDENTIFIER = 'ABSENCES'
    and hat.TRANSACTION_REF_ID is not null
    and hat.item_key = wfis.item_key
    Thanks,
    .....

    This is more a question for the EBS forum than the Reports forum. Better ask it there.

  • Is there any BAPI for Goods receipt that uses LIKP and LIPS tables?

    Hi experts
             I want to pull info for a given delivery note(DN) by joining LIKP and LIPS tables. Is there any existing BAPI that can give my info by using the two tables?
    Please help
    Thanks
    Gopal

    Check the above link and reward points if helpful
    http://help.sap.com/saphelp_nw04/helpdata/en/b0/dad2b40b3611d2a55a0060087832f8/content.htm

  • IBD and GR tables

    HI
    I am developing report for SLA for PO to IBD,IBD to GR,GR to IV.
    I am creating PO with confirmation control as "004".Then i will create IBD.when I post GR with respect to IBD am unable to find the link
    kindly suggest.
    Thanks
    Pramod

    Hi,
    You can use following Tables and join to get data;
    EKES - Vendor Confirmations (PO No & IBD No)
    EKBE - History per Purchasing Document (PO No & GR No)
    Otherwise you can get Inbound Delivery No from "Reference" field (MKPF-XBLNR) for a Goods Receipt from MKPF Table. And then get PO No for GR No from MSEG Table. Join MSEG and MKPF Tables to get details.

  • Help in joining nested table with regular table

    Im creating a nested table codelist as object prtcnpt_info. In a anonymous block im declaring t_code as nested table type codelist.
    Now when i try to join the nested table with the regular oracle DB table and i get error: PL/SQL: ORA-00904: "COLUMN_VALUE": invalid identifier.
    Please help me on this and provide tutorial link pertaining to this concepts..Below is the code i wrote
    --Code Start;
    create or replace type prtcnpt_info as object ( id number
    ,name varchar2(200)
    ,code varchar2(30));
    create type codelist is table of prtcnpt_info;
    declare
    t_code codelist;
    begin
    select prtcnpt_info(b.pid ,b.name ,pt.code) bulk collect into t_code
    from part pt
    ,mc_code b
    where pt.cd in ('AAA','BBB')
    and pt.ptype_id=b.pt_type_id;
    INSERT INTO table ( ID
    ,RUN_ID
    ,DATA
    ,P_ID
    SELECT id
         ,run_id
         ,data
         ,prtct.id ----> 1
    FROM table_2 t2
    ,(select column_value from table(t_code)) prtct
    WHERE prtct.id=t2.P_ID; ------> 2
    end;
    --Code End;
    also from the anonymous block
    1 => is this correct way to get value of id (b.pid) from the nested tablet_code aliased as prtct ?
    2 => is this correct way to join the nested table with regular table? i want to join the column id's in both the tables.
    Edited by: 914912 on Apr 30, 2012 2:11 AM

    When you create a table type without an object, i.e. a single column type like this you will get the column name as COLUMN_VALUE.
    SQL*Plus: Release 10.2.0.5.0 - Production on Mon Apr 30 07:38:32 2012
    Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> create or replace type mytbl as table of varchar2(10)
      2  /
    Type created.
    SQL> var rc refcursor
    "afiedt.buf" 11 lines, 162 characters
      1  declare
      2     ltbl mytbl;
      3  begin
      4     select to_char(level) bulk collect into ltbl
      5       from dual
      6    connect by level <= 10;
      7     open :rc for
      8     select * from table(ltbl);
      9* end;
    10  /
    PL/SQL procedure successfully completed.
    SQL> print rc
    COLUMN_VAL
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    10 rows selected.And when you create a table type with object you will get the object column name.
    SQL> drop type mytbl
      2  /
    Type dropped.
    SQL> create type myobj as object (id varchar2(10))
      2  /
    Type created.
    SQL> create type mytbl as table of myobj
      2  /
    Type created.
    SQL> declare
      2     ltbl mytbl;
      3  begin
      4     select myobj(to_char(level)) bulk collect into ltbl
      5       from dual
      6    connect by level <= 10;
      7     open :rc for
      8     select * from table(ltbl);
      9  end;
    10  /
    PL/SQL procedure successfully completed.
    SQL> print rc
    ID
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    10 rows selected.
    SQL>

  • Poor performance while join of 2 comprehensive large views and small table

    Hi,
    The following SQL statement has been identified to perform poorly. It currently takes up to 6 seconds to execute, but it's supposed to take ~30-40ms at most.
    This is the statement(all bind variables change to numbers):
    SELECT v__96.connector_objectid, v__96.connector_classid, v__96.from_objectid,
           v__96.to_objectid, v__96.from_classid, v__96.to_classid,
           v__96.from_firstunit, v__96.to_firstunit, v__96.number_of_units,
           tmp_trace.first_unit, tmp_trace.last_unit, v__96.inv_status_number,
           tmp_trace.first_unit, tmp_trace.last_unit, v__96.answers,
           v__96.priority, v__97.first_unit, v__97.n_units,
           v__97.mid_span_distance
      FROM ne.tmp_trace,
           (SELECT b.objectid, b.answers, b.connector_classid,
                   b.connector_objectid, b.from_classid, b.from_objectid,
                   b.to_classid, b.to_objectid, b.from_firstunit, b.to_firstunit,
                   b.number_of_units, b.inv_status_number, b.splice_closure_name,
                   b.work_order_name, b.work_order_item_number,
                   b.inventory_status_code, b.priority
              FROM ne.connection b
             WHERE b.objectid NOT IN (
                      SELECT /*+ HASH_AJ */
                             sde_deletes_row_id
                        FROM ne.d96
                       WHERE deleted_at IN (
                                SELECT l.lineage_id
                                  FROM sde.state_lineages l
                                 WHERE l.lineage_name = 2
                                   AND l.lineage_id <= 115)
                         AND sde_state_id = 0)
            UNION ALL
            SELECT a.objectid, a.answers, a.connector_classid,
                   a.connector_objectid, a.from_classid, a.from_objectid,
                   a.to_classid, a.to_objectid, a.from_firstunit, a.to_firstunit,
                   a.number_of_units, a.inv_status_number, a.splice_closure_name,
                   a.work_order_name, a.work_order_item_number,
                   a.inventory_status_code, a.priority
              FROM ne.a96 a, sde.state_lineages sl
             WHERE (a.objectid, a.sde_state_id) NOT IN (
                      SELECT /*+ HASH_AJ */
                             sde_deletes_row_id, sde_state_id
                        FROM ne.d96
                       WHERE deleted_at IN (
                                SELECT l.lineage_id
                                  FROM sde.state_lineages l
                                 WHERE l.lineage_name = 2
                                   AND l.lineage_id <= 115)
                         AND sde_state_id > 0)
               AND a.sde_state_id = sl.lineage_id
               AND sl.lineage_name = 2
               AND sl.lineage_id <= 115) v__96,
           (SELECT b.objectid, b.tray_number, b.db_loss, b.first_unit, b.n_units,
                   b.connection_objectid, b.connector_type_name,
                   b.dedicated_status, b.mid_span_distance
              FROM ne.connection_attributes b
             WHERE b.objectid NOT IN (
                      SELECT /*+ HASH_AJ */
                             sde_deletes_row_id
                        FROM ne.d97
                       WHERE deleted_at IN (
                                SELECT l.lineage_id
                                  FROM sde.state_lineages l
                                 WHERE l.lineage_name = 2
                                   AND l.lineage_id <= 115)
                         AND sde_state_id = 0)
            UNION ALL
            SELECT a.objectid, a.tray_number, a.db_loss, a.first_unit, a.n_units,
                   a.connection_objectid, a.connector_type_name,
                   a.dedicated_status, a.mid_span_distance
              FROM ne.a97 a, sde.state_lineages sl
             WHERE (a.objectid, a.sde_state_id) NOT IN (
                      SELECT /*+ HASH_AJ */
                             sde_deletes_row_id, sde_state_id
                        FROM ne.d97
                       WHERE deleted_at IN (
                                SELECT l.lineage_id
                                  FROM sde.state_lineages l
                                 WHERE l.lineage_name = 2
                                   AND l.lineage_id <= 115)
                         AND sde_state_id > 0)
               AND a.sde_state_id = sl.lineage_id
               AND sl.lineage_name = 2
               AND sl.lineage_id <= 115) v__97
    WHERE (    (    (    (    (   (    ne.tmp_trace.equipment_object_id =
                                                                 v__96.to_objectid
                                    AND v__96.to_classid = 9
                                OR (    ne.tmp_trace.transmedia_object_id =
                                                                 v__96.to_objectid
                                    AND v__96.to_classid = 5
                           AND (   (v__96.to_firstunit
                                       BETWEEN ne.tmp_trace.first_unit
                                           AND ne.tmp_trace.last_unit
                                OR (ne.tmp_trace.first_unit
                                       BETWEEN v__96.to_firstunit
                                           AND   v__96.to_firstunit
                                               + v__96.number_of_units
                                               - 1
                      AND v__96.answers = 0
                 AND v__96.objectid = v__97.connection_objectid
            AND (ne.tmp_trace.session_id = -1234)
           );It should return many values from 2 comprehensive views (v__96, v__97) and business table (tmp_trace). 2 comprehensive views ~1,000,000 recs each, business table ~ 10 recs.
    The version of the database is 11.1.0.6.
    These are the parameters relevant to the optimizer:
    SQL> show parameter optimizer
    NAME                                 TYPE                             VALUE
    optimizer_capture_sql_plan_baselines boolean                          FALSE
    optimizer_dynamic_sampling           integer                          2
    optimizer_features_enable            string                           11.1.0.6
    optimizer_index_caching              integer                          0
    optimizer_index_cost_adj             integer                          100
    optimizer_mode                       string                           ALL_ROWS
    optimizer_secure_view_merging        boolean                          TRUE
    optimizer_use_invisible_indexes      boolean                          FALSE
    optimizer_use_pending_statistics     boolean                          FALSE
    optimizer_use_sql_plan_baselines     boolean                          TRUE
    SQL> show parameter db_file_multi
    NAME                                 TYPE                             VALUE
    db_file_multiblock_read_count        integer                          128
    SQL> show parameter db_block_size
    NAME                                 TYPE                             VALUE
    db_block_size                        integer                          8192
    SQL> show parameter cursor_sharing
    NAME                                 TYPE                             VALUE
    cursor_sharing                       string                           FORCE
    SQL> column sname format a20
    SQL> column pname format a20
    SQL> column pval2 format a20
    SQL> select sname, pname, pval1, pval2 from sys.aux_stats$;
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_INFO        STATUS                          COMPLETED
    SYSSTATS_INFO        DSTART                          07-15-2009 10:27
    SYSSTATS_INFO        DSTOP                           07-15-2009 10:27
    SYSSTATS_INFO        FLAGS                         1
    SYSSTATS_MAIN        CPUSPEEDNW           1812.32129
    SYSSTATS_MAIN        IOSEEKTIM                    10
    SYSSTATS_MAIN        IOTFRSPEED                 4096
    SYSSTATS_MAIN        SREADTIM
    SYSSTATS_MAIN        MREADTIM
    SYSSTATS_MAIN        CPUSPEED
    SYSSTATS_MAIN        MBRC
    SNAME                PNAME                     PVAL1 PVAL2
    SYSSTATS_MAIN        MAXTHR
    SYSSTATS_MAIN        SLAVETHR
    13 rows selected.Here is the output of EXPLAIN PLAN:
    explain plan for -- statement above
    SQL> select * from table(dbms_xplan.display);
    PLAN_TABLE_OUTPUT
    Plan hash value: 1005186751
    | Id  | Operation                          | Name                  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                   |                       |     1 |   282 |   268   (2)| 00:00:04 |
    |   1 |  NESTED LOOPS                      |                       |     1 |   282 |   268   (2)| 00:00:04 |
    |   2 |   MERGE JOIN CARTESIAN             |                       |     1 |   119 |   260   (1)| 00:00:04 |
    |*  3 |    TABLE ACCESS FULL               | TMP_TRACE             |     1 |    65 |     2   (0)| 00:00:01 |
    |   4 |    BUFFER SORT                     |                       |   103K|  5467K|   258   (1)| 00:00:04 |
    |   5 |     VIEW                           |                       |   103K|  5467K|   258   (1)| 00:00:04 |
    |   6 |      UNION-ALL                     |                       |       |       |            |       |
    |   7 |       NESTED LOOPS ANTI            |                       |     1 |    82 |     3   (0)| 00:00:01 |
    |   8 |        TABLE ACCESS FULL           | CONNECTION_ATTRIBUTES |     1 |    78 |     2   (0)| 00:00:01 |
    |   9 |        VIEW PUSHED PREDICATE       | VW_NSO_1              |     1 |     4 |     1   (0)| 00:00:01 |
    |  10 |         NESTED LOOPS               |                       |     1 |    20 |     1   (0)| 00:00:01 |
    |* 11 |          INDEX RANGE SCAN          | LINEAGES_PK           |     5 |    35 |     1   (0)| 00:00:01 |
    |* 12 |          INDEX UNIQUE SCAN         | D97_PK                |     1 |    13 |     0   (0)| 00:00:01 |
    |* 13 |       HASH JOIN RIGHT ANTI         |                       |   103K|  5568K|   255   (1)| 00:00:04 |
    |  14 |        VIEW                        | VW_NSO_2              |     1 |    26 |     2   (0)| 00:00:01 |
    |  15 |         NESTED LOOPS               |                       |     1 |    20 |     2   (0)| 00:00:01 |
    |* 16 |          INDEX FAST FULL SCAN      | D97_PK                |     1 |    13 |     2   (0)| 00:00:01 |
    |* 17 |          INDEX UNIQUE SCAN         | LINEAGES_PK           |     1 |     7 |     0   (0)| 00:00:01 |
    |  18 |        NESTED LOOPS                |                       |       |       |            |       |
    |  19 |         NESTED LOOPS               |                       |   103K|  2936K|   252   (1)| 00:00:04 |
    |* 20 |          INDEX RANGE SCAN          | LINEAGES_PK           |     5 |    35 |     1   (0)| 00:00:01 |
    |* 21 |          INDEX RANGE SCAN          | A97_STATEID_IX1       | 17731 |       |    32   (0)| 00:00:01 |
    |  22 |         TABLE ACCESS BY INDEX ROWID| A97                   | 21491 |   461K|   123   (1)| 00:00:02 |
    |* 23 |   VIEW                             |                       |     1 |   163 |     8  (13)| 00:00:01 |
    |  24 |    UNION ALL PUSHED PREDICATE      |                       |       |       |            |       |
    |  25 |     NESTED LOOPS ANTI              |                       |     1 |   185 |     1   (0)| 00:00:01 |
    |* 26 |      TABLE ACCESS BY INDEX ROWID   | CONNECTION            |     1 |   181 |     0   (0)| 00:00:01 |
    |* 27 |       INDEX UNIQUE SCAN            | R96_SDE_ROWID_UK      |     1 |       |     0   (0)| 00:00:01 |
    |  28 |      VIEW PUSHED PREDICATE         | VW_NSO_3              |     1 |     4 |     1   (0)| 00:00:01 |
    |  29 |       NESTED LOOPS                 |                       |     1 |    20 |     1   (0)| 00:00:01 |
    |* 30 |        INDEX RANGE SCAN            | LINEAGES_PK           |     5 |    35 |     1   (0)| 00:00:01 |
    |* 31 |        INDEX UNIQUE SCAN           | D96_PK                |     1 |    13 |     0   (0)| 00:00:01 |
    |* 32 |     HASH JOIN ANTI                 |                       |     1 |    97 |     7  (15)| 00:00:01 |
    |  33 |      NESTED LOOPS                  |                       |     1 |    71 |     4   (0)| 00:00:01 |
    |* 34 |       TABLE ACCESS BY INDEX ROWID  | A96                   |     1 |    64 |     4   (0)| 00:00:01 |
    |* 35 |        INDEX RANGE SCAN            | A96_PK                |     1 |       |     3   (0)| 00:00:01 |
    |* 36 |       INDEX UNIQUE SCAN            | LINEAGES_PK           |     1 |     7 |     0   (0)| 00:00:01 |
    |  37 |      VIEW                          | VW_NSO_4              |     1 |    26 |     2   (0)| 00:00:01 |
    |  38 |       NESTED LOOPS                 |                       |     1 |    20 |     2   (0)| 00:00:01 |
    |* 39 |        INDEX FAST FULL SCAN        | D96_PK                |     1 |    13 |     2   (0)| 00:00:01 |
    |* 40 |        INDEX UNIQUE SCAN           | LINEAGES_PK           |     1 |     7 |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       3 - filter("TMP_TRACE"."SESSION_ID"=(-1234))
      11 - access("L"."LINEAGE_NAME"=2 AND "L"."LINEAGE_ID"<=115)
      12 - access("DELETED_AT"="L"."LINEAGE_ID" AND "SDE_DELETES_ROW_ID"="B"."OBJECTID" AND
                  "SDE_STATE_ID"=0)
           filter("DELETED_AT"<=115)
      13 - access("A"."OBJECTID"="SDE_DELETES_ROW_ID" AND "A"."SDE_STATE_ID"="SDE_STATE_ID")
      16 - filter("DELETED_AT"<=115 AND "SDE_STATE_ID"<=115 AND "SDE_STATE_ID">0)
      17 - access("L"."LINEAGE_NAME"=2 AND "DELETED_AT"="L"."LINEAGE_ID")
           filter("L"."LINEAGE_ID"<=115)
      20 - access("SL"."LINEAGE_NAME"=2 AND "SL"."LINEAGE_ID"<=115)
      21 - access("A"."SDE_STATE_ID"="SL"."LINEAGE_ID")
           filter("A"."SDE_STATE_ID"<=115)
      23 - filter(("TMP_TRACE"."EQUIPMENT_OBJECT_ID"="V__96"."TO_OBJECTID" AND "V__96"."TO_CLASSID"=9
                  OR "TMP_TRACE"."TRANSMEDIA_OBJECT_ID"="V__96"."TO_OBJECTID" AND "V__96"."TO_CLASSID"=5) AND
                  ("V__96"."TO_FIRSTUNIT">="TMP_TRACE"."FIRST_UNIT" AND
                  "V__96"."TO_FIRSTUNIT"<="TMP_TRACE"."LAST_UNIT" OR "TMP_TRACE"."FIRST_UNIT">="V__96"."TO_FIRSTUNIT"
                  AND "TMP_TRACE"."FIRST_UNIT"<="V__96"."TO_FIRSTUNIT"+"V__96"."NUMBER_OF_UNITS"-1))
      26 - filter("B"."ANSWERS"=0)
      27 - access("B"."OBJECTID"="V__97"."CONNECTION_OBJECTID")
      30 - access("L"."LINEAGE_NAME"=2 AND "L"."LINEAGE_ID"<=115)
      31 - access("DELETED_AT"="L"."LINEAGE_ID" AND "SDE_DELETES_ROW_ID"="B"."OBJECTID" AND
                  "SDE_STATE_ID"=0)
           filter("DELETED_AT"<=115)
      32 - access("A"."OBJECTID"="SDE_DELETES_ROW_ID" AND "A"."SDE_STATE_ID"="SDE_STATE_ID")
      34 - filter("A"."ANSWERS"=0)
      35 - access("A"."OBJECTID"="V__97"."CONNECTION_OBJECTID" AND "A"."SDE_STATE_ID"<=115)
      36 - access("SL"."LINEAGE_NAME"=2 AND "A"."SDE_STATE_ID"="SL"."LINEAGE_ID")
           filter("SL"."LINEAGE_ID"<=115)
      39 - filter("DELETED_AT"<=115 AND "SDE_STATE_ID"<=115 AND
                  "SDE_DELETES_ROW_ID"="V__97"."CONNECTION_OBJECTID" AND "SDE_STATE_ID">0)
      40 - access("L"."LINEAGE_NAME"=2 AND "DELETED_AT"="L"."LINEAGE_ID")
           filter("L"."LINEAGE_ID"<=115)
    Note
       - dynamic sampling used for this statement
    87 rows selected.Here is the output of SQL*Plus AUTOTRACE including the TIMING information:
    SQL> set autotrace traceonly arraysize 100
    Elapsed: 00:00:01.64
    Execution Plan
    Plan hash value: 1198408274
    | Id  | Operation                          | Name                  | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT                   |                       |   876K|   238M|  1301   (2)| 00:00:16 |
    |   1 |  CONCATENATION                     |                       |       |       |            |       |
    |*  2 |   HASH JOIN                        |                       |   438K|   119M|   651   (2)| 00:00:08 |
    |*  3 |    HASH JOIN                       |                       |   423 | 98559 |   390   (2)| 00:00:05 |
    |*  4 |     TABLE ACCESS FULL              | TMP_TRACE             |    82 |  5330 |    29   (0)| 00:00:01 |
    |*  5 |     VIEW                           |                       |   103K|    16M|   360   (1)| 00:00:05 |
    |   6 |      UNION-ALL                     |                       |       |       |            |       |
    |   7 |       NESTED LOOPS ANTI            |                       |     1 |   185 |     3   (0)| 00:00:01 |
    |*  8 |        TABLE ACCESS FULL           | CONNECTION            |     1 |   181 |     2   (0)| 00:00:01 |
    |   9 |        VIEW PUSHED PREDICATE       | VW_NSO_3              |     1 |     4 |     1   (0)| 00:00:01 |
    |  10 |         NESTED LOOPS               |                       |     1 |    20 |     1   (0)| 00:00:01 |
    |* 11 |          INDEX RANGE SCAN          | LINEAGES_PK           |     5 |    35 |     1   (0)| 00:00:01 |
    |* 12 |          INDEX UNIQUE SCAN         | D96_PK                |     1 |    13 |     0   (0)| 00:00:01 |
    |* 13 |       HASH JOIN RIGHT ANTI         |                       |   103K|  9820K|   357   (1)| 00:00:05 |
    |  14 |        VIEW                        | VW_NSO_4              |     1 |    26 |     2   (0)| 00:00:01 |
    |  15 |         NESTED LOOPS               |                       |     1 |    20 |     2   (0)| 00:00:01 |
    |* 16 |          INDEX FAST FULL SCAN      | D96_PK                |     1 |    13 |     2   (0)| 00:00:01 |
    |* 17 |          INDEX UNIQUE SCAN         | LINEAGES_PK           |     1 |     7 |     0   (0)| 00:00:01 |
    |  18 |        NESTED LOOPS                |                       |       |       |            |       |
    |  19 |         NESTED LOOPS               |                       |   103K|  7188K|   354   (1)| 00:00:05 |
    |* 20 |          INDEX RANGE SCAN          | LINEAGES_PK           |     5 |    35 |     1   (0)| 00:00:01 |
    |* 21 |          INDEX RANGE SCAN          | A96_STATEID_IX1       | 17731 |       |    32   (0)| 00:00:01 |
    |* 22 |         TABLE ACCESS BY INDEX ROWID| A96                   | 21491 |  1343K|   224   (1)| 00:00:03 |
    |  23 |    VIEW                            |                       |   103K|  5264K|   258   (1)| 00:00:04 |
    |  24 |     UNION-ALL                      |                       |       |       |            |       |
    |  25 |      NESTED LOOPS ANTI             |                       |     1 |    82 |     3   (0)| 00:00:01 |
    |  26 |       TABLE ACCESS FULL            | CONNECTION_ATTRIBUTES |     1 |    78 |     2   (0)| 00:00:01 |
    |  27 |       VIEW PUSHED PREDICATE        | VW_NSO_1              |     1 |     4 |     1   (0)| 00:00:01 |
    |  28 |        NESTED LOOPS                |                       |     1 |    20 |     1   (0)| 00:00:01 |
    |* 29 |         INDEX RANGE SCAN           | LINEAGES_PK           |     5 |    35 |     1   (0)| 00:00:01 |
    |* 30 |         INDEX UNIQUE SCAN          | D97_PK                |     1 |    13 |     0   (0)| 00:00:01 |
    |* 31 |      HASH JOIN RIGHT ANTI          |                       |   103K|  5568K|   255   (1)| 00:00:04 |
    |  32 |       VIEW                         | VW_NSO_2              |     1 |    26 |     2   (0)| 00:00:01 |
    |  33 |        NESTED LOOPS                |                       |     1 |    20 |     2   (0)| 00:00:01 |
    |* 34 |         INDEX FAST FULL SCAN       | D97_PK                |     1 |    13 |     2   (0)| 00:00:01 |
    |* 35 |         INDEX UNIQUE SCAN          | LINEAGES_PK           |     1 |     7 |     0   (0)| 00:00:01 |
    |  36 |       NESTED LOOPS                 |                       |       |       |            |       |
    |  37 |        NESTED LOOPS                |                       |   103K|  2936K|   252   (1)| 00:00:04 |
    |* 38 |         INDEX RANGE SCAN           | LINEAGES_PK           |     5 |    35 |     1   (0)| 00:00:01 |
    |* 39 |         INDEX RANGE SCAN           | A97_STATEID_IX1       | 17731 |       |    32   (0)| 00:00:01 |
    |  40 |        TABLE ACCESS BY INDEX ROWID | A97                   | 21491 |   461K|   123   (1)| 00:00:02 |
    |* 41 |   HASH JOIN                        |                       |   438K|   119M|   651   (2)| 00:00:08 |
    |* 42 |    HASH JOIN                       |                       |   423 | 98559 |   390   (2)| 00:00:05 |
    |* 43 |     TABLE ACCESS FULL              | TMP_TRACE             |    82 |  5330 |    29   (0)| 00:00:01 |
    |* 44 |     VIEW                           |                       |   103K|    16M|   360   (1)| 00:00:05 |
    |  45 |      UNION-ALL                     |                       |       |       |            |       |
    |  46 |       NESTED LOOPS ANTI            |                       |     1 |   185 |     3   (0)| 00:00:01 |
    |* 47 |        TABLE ACCESS FULL           | CONNECTION            |     1 |   181 |     2   (0)| 00:00:01 |
    |  48 |        VIEW PUSHED PREDICATE       | VW_NSO_3              |     1 |     4 |     1   (0)| 00:00:01 |
    |  49 |         NESTED LOOPS               |                       |     1 |    20 |     1   (0)| 00:00:01 |
    |* 50 |          INDEX RANGE SCAN          | LINEAGES_PK           |     5 |    35 |     1   (0)| 00:00:01 |
    |* 51 |          INDEX UNIQUE SCAN         | D96_PK                |     1 |    13 |     0   (0)| 00:00:01 |
    |* 52 |       HASH JOIN RIGHT ANTI         |                       |   103K|  9820K|   357   (1)| 00:00:05 |
    |  53 |        VIEW                        | VW_NSO_4              |     1 |    26 |     2   (0)| 00:00:01 |
    |  54 |         NESTED LOOPS               |                       |     1 |    20 |     2   (0)| 00:00:01 |
    |* 55 |          INDEX FAST FULL SCAN      | D96_PK                |     1 |    13 |     2   (0)| 00:00:01 |
    |* 56 |          INDEX UNIQUE SCAN         | LINEAGES_PK           |     1 |     7 |     0   (0)| 00:00:01 |
    |  57 |        NESTED LOOPS                |                       |       |       |            |       |
    |  58 |         NESTED LOOPS               |                       |   103K|  7188K|   354   (1)| 00:00:05 |
    |* 59 |          INDEX RANGE SCAN          | LINEAGES_PK           |     5 |    35 |     1   (0)| 00:00:01 |
    |* 60 |          INDEX RANGE SCAN          | A96_STATEID_IX1       | 17731 |       |    32   (0)| 00:00:01 |
    |* 61 |         TABLE ACCESS BY INDEX ROWID| A96                   | 21491 |  1343K|   224   (1)| 00:00:03 |
    |  62 |    VIEW                            |                       |   103K|  5264K|   258   (1)| 00:00:04 |
    |  63 |     UNION-ALL                      |                       |       |       |            |       |
    |  64 |      NESTED LOOPS ANTI             |                       |     1 |    82 |     3   (0)| 00:00:01 |
    |  65 |       TABLE ACCESS FULL            | CONNECTION_ATTRIBUTES |     1 |    78 |     2   (0)| 00:00:01 |
    |  66 |       VIEW PUSHED PREDICATE        | VW_NSO_1              |     1 |     4 |     1   (0)| 00:00:01 |
    |  67 |        NESTED LOOPS                |                       |     1 |    20 |     1   (0)| 00:00:01 |
    |* 68 |         INDEX RANGE SCAN           | LINEAGES_PK           |     5 |    35 |     1   (0)| 00:00:01 |
    |* 69 |         INDEX UNIQUE SCAN          | D97_PK                |     1 |    13 |     0   (0)| 00:00:01 |
    |* 70 |      HASH JOIN RIGHT ANTI          |                       |   103K|  5568K|   255   (1)| 00:00:04 |
    |  71 |       VIEW                         | VW_NSO_2              |     1 |    26 |     2   (0)| 00:00:01 |
    |  72 |        NESTED LOOPS                |                       |     1 |    20 |     2   (0)| 00:00:01 |
    |* 73 |         INDEX FAST FULL SCAN       | D97_PK                |     1 |    13 |     2   (0)| 00:00:01 |
    |* 74 |         INDEX UNIQUE SCAN          | LINEAGES_PK           |     1 |     7 |     0   (0)| 00:00:01 |
    |  75 |       NESTED LOOPS                 |                       |       |       |            |       |
    |  76 |        NESTED LOOPS                |                       |   103K|  2936K|   252   (1)| 00:00:04 |
    |* 77 |         INDEX RANGE SCAN           | LINEAGES_PK           |     5 |    35 |     1   (0)| 00:00:01 |
    |* 78 |         INDEX RANGE SCAN           | A97_STATEID_IX1       | 17731 |       |    32   (0)| 00:00:01 |
    |  79 |        TABLE ACCESS BY INDEX ROWID | A97                   | 21491 |   461K|   123   (1)| 00:00:02 |
    Predicate Information (identified by operation id):
       2 - access("V__96"."OBJECTID"="V__97"."CONNECTION_OBJECTID")
       3 - access("TMP_TRACE"."TRANSMEDIA_OBJECT_ID"="V__96"."TO_OBJECTID")
           filter("V__96"."TO_FIRSTUNIT">="TMP_TRACE"."FIRST_UNIT" AND
                  "V__96"."TO_FIRSTUNIT"<="TMP_TRACE"."LAST_UNIT" OR "TMP_TRACE"."FIRST_UNIT">="V__96"."TO_FIRSTUNIT"
                  AND "TMP_TRACE"."FIRST_UNIT"<="V__96"."TO_FIRSTUNIT"+"V__96"."NUMBER_OF_UNITS"-1)
       4 - filter("TMP_TRACE"."SESSION_ID"=(-1234))
       5 - filter("V__96"."TO_CLASSID"=5)
       8 - filter("B"."ANSWERS"=0)
      11 - access("L"."LINEAGE_NAME"=2 AND "L"."LINEAGE_ID"<=115)
      12 - access("DELETED_AT"="L"."LINEAGE_ID" AND "SDE_DELETES_ROW_ID"="B"."OBJECTID" AND
                  "SDE_STATE_ID"=0)
           filter("DELETED_AT"<=115)
      13 - access("A"."OBJECTID"="SDE_DELETES_ROW_ID" AND "A"."SDE_STATE_ID"="SDE_STATE_ID")
      16 - filter("DELETED_AT"<=115 AND "SDE_STATE_ID"<=115 AND "SDE_STATE_ID">0)
      17 - access("L"."LINEAGE_NAME"=2 AND "DELETED_AT"="L"."LINEAGE_ID")
           filter("L"."LINEAGE_ID"<=115)
      20 - access("SL"."LINEAGE_NAME"=2 AND "SL"."LINEAGE_ID"<=115)
      21 - access("A"."SDE_STATE_ID"="SL"."LINEAGE_ID")
           filter("A"."SDE_STATE_ID"<=115)
      22 - filter("A"."ANSWERS"=0)
      29 - access("L"."LINEAGE_NAME"=2 AND "L"."LINEAGE_ID"<=115)
      30 - access("DELETED_AT"="L"."LINEAGE_ID" AND "SDE_DELETES_ROW_ID"="B"."OBJECTID" AND
                  "SDE_STATE_ID"=0)
           filter("DELETED_AT"<=115)
      31 - access("A"."OBJECTID"="SDE_DELETES_ROW_ID" AND "A"."SDE_STATE_ID"="SDE_STATE_ID")
      34 - filter("DELETED_AT"<=115 AND "SDE_STATE_ID"<=115 AND "SDE_STATE_ID">0)
      35 - access("L"."LINEAGE_NAME"=2 AND "DELETED_AT"="L"."LINEAGE_ID")
           filter("L"."LINEAGE_ID"<=115)
      38 - access("SL"."LINEAGE_NAME"=2 AND "SL"."LINEAGE_ID"<=115)
      39 - access("A"."SDE_STATE_ID"="SL"."LINEAGE_ID")
           filter("A"."SDE_STATE_ID"<=115)
      41 - access("V__96"."OBJECTID"="V__97"."CONNECTION_OBJECTID")
      42 - access("TMP_TRACE"."EQUIPMENT_OBJECT_ID"="V__96"."TO_OBJECTID")
           filter((LNNVL("TMP_TRACE"."TRANSMEDIA_OBJECT_ID"="V__96"."TO_OBJECTID") OR
                  LNNVL("V__96"."TO_CLASSID"=5)) AND ("V__96"."TO_FIRSTUNIT">="TMP_TRACE"."FIRST_UNIT" AND
                  "V__96"."TO_FIRSTUNIT"<="TMP_TRACE"."LAST_UNIT" OR "TMP_TRACE"."FIRST_UNIT">="V__96"."TO_FIRSTUNIT"
                  AND "TMP_TRACE"."FIRST_UNIT"<="V__96"."TO_FIRSTUNIT"+"V__96"."NUMBER_OF_UNITS"-1))
      43 - filter("TMP_TRACE"."SESSION_ID"=(-1234))
      44 - filter("V__96"."TO_CLASSID"=9)
      47 - filter("B"."ANSWERS"=0)
      50 - access("L"."LINEAGE_NAME"=2 AND "L"."LINEAGE_ID"<=115)
      51 - access("DELETED_AT"="L"."LINEAGE_ID" AND "SDE_DELETES_ROW_ID"="B"."OBJECTID" AND
                  "SDE_STATE_ID"=0)
           filter("DELETED_AT"<=115)
      52 - access("A"."OBJECTID"="SDE_DELETES_ROW_ID" AND "A"."SDE_STATE_ID"="SDE_STATE_ID")
      55 - filter("DELETED_AT"<=115 AND "SDE_STATE_ID"<=115 AND "SDE_STATE_ID">0)
      56 - access("L"."LINEAGE_NAME"=2 AND "DELETED_AT"="L"."LINEAGE_ID")
           filter("L"."LINEAGE_ID"<=115)
      59 - access("SL"."LINEAGE_NAME"=2 AND "SL"."LINEAGE_ID"<=115)
      60 - access("A"."SDE_STATE_ID"="SL"."LINEAGE_ID")
           filter("A"."SDE_STATE_ID"<=115)
      61 - filter("A"."ANSWERS"=0)
      68 - access("L"."LINEAGE_NAME"=2 AND "L"."LINEAGE_ID"<=115)
      69 - access("DELETED_AT"="L"."LINEAGE_ID" AND "SDE_DELETES_ROW_ID"="B"."OBJECTID" AND
                  "SDE_STATE_ID"=0)
           filter("DELETED_AT"<=115)
      70 - access("A"."OBJECTID"="SDE_DELETES_ROW_ID" AND "A"."SDE_STATE_ID"="SDE_STATE_ID")
      73 - filter("DELETED_AT"<=115 AND "SDE_STATE_ID"<=115 AND "SDE_STATE_ID">0)
      74 - access("L"."LINEAGE_NAME"=2 AND "DELETED_AT"="L"."LINEAGE_ID")
           filter("L"."LINEAGE_ID"<=115)
      77 - access("SL"."LINEAGE_NAME"=2 AND "SL"."LINEAGE_ID"<=115)
      78 - access("A"."SDE_STATE_ID"="SL"."LINEAGE_ID")
           filter("A"."SDE_STATE_ID"<=115)
    Note
       - dynamic sampling used for this statementThe TKPROF output for this statement looks like the following:
    TKPROF: Release 11.1.0.6.0 - Production on Thu Sep 24 09:30:01 2009
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Trace file: pro                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           &

    The TKPROF output for this statement looks like the following:
    TKPROF: Release 11.1.0.6.0 - Production on Thu Sep 24 09:30:01 2009
    Copyright (c) 1982, 2007, Oracle.  All rights reserved.
    Trace file: problem.trc
    Sort options: default
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    SELECT  V__96.CONNECTOR_OBJECTID,  V__96.CONNECTOR_CLASSID,  V__96.FROM_OBJECTID,  V__96.TO_OBJECTID,  V__96.FROM_CLASSID,  V__96.TO_CLASSID, 
    V__96.FROM_FIRSTUNIT,  V__96.TO_FIRSTUNIT,  V__96.NUMBER_OF_UNITS,  TMP_TRACE.FIRST_UNIT,  TMP_TRACE.LAST_UNIT,  V__96.INV_STATUS_NUMBER, 
    TMP_TRACE.FIRST_UNIT,  TMP_TRACE.LAST_UNIT,  V__96.ANSWERS,  V__96.PRIORITY,  V__97.FIRST_UNIT,  V__97.N_UNITS,  V__97.MID_SPAN_DISTANCE  FROM 
    NE.TMP_TRACE,(SELECT
    b.OBJECTID,b.ANSWERS,b.CONNECTOR_CLASSID,b.CONNECTOR_OBJECTID,b.FROM_CLASSID,b.FROM_OBJECTID,b.TO_CLASSID,b.TO_OBJECTID,b.FROM_FIRSTUNIT,b.TO_FIRSTUNIT,b.NUM
    BER_OF_UNITS,b.INV_STATUS_NUMBER,b.SPLICE_CLOSURE_NAME,b.WORK_ORDER_NAME,b.WORK_ORDER_ITEM_NUMBER,b.INVENTORY_STATUS_CODE,b.PRIORITY  FROM NE.connection b
    WHERE b.OBJECTID NOT IN (SELECT /*+ HASH_AJ */ SDE_DELETES_ROW_ID FROM NE.D96 WHERE DELETED_AT IN (SELECT l.lineage_id FROM SDE.state_lineages l WHERE
    l.lineage_name = :"SYS_B_00" AND l.lineage_id <= :"SYS_B_01") AND SDE_STATE_ID = :"SYS_B_02") UNION ALL SELECT
    a.OBJECTID,a.ANSWERS,a.CONNECTOR_CLASSID,a.CONNECTOR_OBJECTID,a.FROM_CLASSID,a.FROM_OBJECTID,a.TO_CLASSID,a.TO_OBJECTID,a.FROM_FIRSTUNIT,a.TO_FIRSTUNIT,a.NUM
    BER_OF_UNITS,a.INV_STATUS_NUMBER,a.SPLICE_CLOSURE_NAME,a.WORK_ORDER_NAME,a.WORK_ORDER_ITEM_NUMBER,a.INVENTORY_STATUS_CODE,a.PRIORITY  FROM NE.A96
    a,SDE.state_lineages SL WHERE (a.OBJECTID, a.SDE_STATE_ID) NOT IN (SELECT /*+ HASH_AJ */ SDE_DELETES_ROW_ID,SDE_STATE_ID  FROM NE.D96 WHERE DELETED_AT IN
    (SELECT l.lineage_id FROM SDE.state_lineages l WHERE l.lineage_name = :"SYS_B_03" AND l.lineage_id <= :"SYS_B_04") AND SDE_STATE_ID > :"SYS_B_05") AND
    a.SDE_STATE_ID = SL.lineage_id AND SL.lineage_name = :"SYS_B_06" AND SL.lineage_id <= :"SYS_B_07") V__96,(SELECT
    b.OBJECTID,b.TRAY_NUMBER,b.DB_LOSS,b.FIRST_UNIT,b.N_UNITS,b.CONNECTION_OBJECTID,b.CONNECTOR_TYPE_NAME,b.DEDICATED_STATUS,b.MID_SPAN_DISTANCE  FROM
    NE.connection_attributes b WHERE b.OBJECTID NOT IN (SELECT /*+ HASH_AJ */ SDE_DELETES_ROW_ID FROM NE.D97 WHERE DELETED_AT IN (SELECT l.lineage_id FROM
    SDE.state_lineages l WHERE l.lineage_name = :"SYS_B_08" AND l.lineage_id <= :"SYS_B_09") AND SDE_STATE_ID = :"SYS_B_10") UNION ALL SELECT
    a.OBJECTID,a.TRAY_NUMBER,a.DB_LOSS,a.FIRST_UNIT,a.N_UNITS,a.CONNECTION_OBJECTID,a.CONNECTOR_TYPE_NAME,a.DEDICATED_STATUS,a.MID_SPAN_DISTANCE  FROM NE.A97
    a,SDE.state_lineages SL WHERE (a.OBJECTID, a.SDE_STATE_ID) NOT IN (SELECT /*+ HASH_AJ */ SDE_DELETES_ROW_ID,SDE_STATE_ID  FROM NE.D97 WHERE DELETED_AT IN
    (SELECT l.lineage_id FROM SDE.state_lineages l WHERE l.lineage_name = :"SYS_B_11" AND l.lineage_id <= :"SYS_B_12") AND SDE_STATE_ID > :"SYS_B_13") AND
    a.SDE_STATE_ID = SL.lineage_id AND SL.lineage_name = :"SYS_B_14" AND SL.lineage_id <= :"SYS_B_15") V__97  WHERE (((((   (
                                             NE.tmp_trace.equipment_object_id = V__96.to_objectid
                                              AND
                                             V__96.to_classid = :"SYS_B_16"
                                           OR
                                             NE.tmp_trace.transmedia_object_id = V__96.to_objectid
                                               AND
                                             V__96.to_classid = :"SYS_B_17"
                                             )) AND (
                                            (V__96.to_firstunit
                                                BETWEEN NE.tmp_trace.first_unit AND NE.tmp_trace.last_unit)
                                              OR
                                            (NE.tmp_trace.first_unit BETWEEN V__96.to_firstunit
                                                 AND V__96.to_firstunit + V__96.number_of_units - :"SYS_B_18")
                                          )) AND V__96.answers = :"SYS_B_19") AND V__96.objectid = V__97.connection_objectid) AND (NE.tmp_trace.session_id =
    :"SYS_B_20"))
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        1      5.98       5.99          0      22652          0          10
    total        3      5.98       5.99          0      22652          0          10
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 45 
    Rows     Row Source Operation
         10  NESTED LOOPS  (cr=22652 pr=0 pw=0 time=654515 us cost=67 size=282 card=1)
         10   NESTED LOOPS  (cr=22436 pr=0 pw=0 time=653673 us cost=61 size=235 card=1)
         10    TABLE ACCESS FULL TMP_TRACE (cr=5 pr=0 pw=0 time=7 us cost=2 size=65 card=1)
         10    VIEW  (cr=22431 pr=0 pw=0 time=0 us cost=59 size=170 card=1)
    1773000     UNION-ALL  (cr=22431 pr=0 pw=0 time=93649 us)
          0      NESTED LOOPS ANTI (cr=30 pr=0 pw=0 time=0 us cost=3 size=185 card=1)
          0       TABLE ACCESS FULL CONNECTION (cr=30 pr=0 pw=0 time=0 us cost=2 size=181 card=1)
          0       VIEW PUSHED PREDICATE  VW_NSO_3 (cr=0 pr=0 pw=0 time=0 us cost=1 size=4 card=1)
          0        NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=1 size=20 card=1)
          0         INDEX RANGE SCAN LINEAGES_PK (cr=0 pr=0 pw=0 time=0 us cost=1 size=7 card=1)(object id 34021)
          0         INDEX UNIQUE SCAN D96_PK (cr=0 pr=0 pw=0 time=0 us cost=0 size=13 card=1)(object id 35121)
    1773000      HASH JOIN RIGHT ANTI (cr=22401 pr=0 pw=0 time=75084 us cost=56 size=46948 card=484)
          0       VIEW  VW_NSO_4 (cr=180 pr=0 pw=0 time=0 us cost=2 size=26 card=1)
          0        FILTER  (cr=180 pr=0 pw=0 time=0 us)
          0         NESTED LOOPS  (cr=180 pr=0 pw=0 time=0 us cost=2 size=20 card=1)
          0          INDEX FAST FULL SCAN D96_PK (cr=180 pr=0 pw=0 time=0 us cost=2 size=13 card=1)(object id 35121)
          0          INDEX UNIQUE SCAN LINEAGES_PK (cr=0 pr=0 pw=0 time=0 us cost=0 size=7 card=1)(object id 34021)
    1773000       NESTED LOOPS  (cr=22221 pr=0 pw=0 time=56155 us)
    1773000        NESTED LOOPS  (cr=3231 pr=0 pw=0 time=15078 us cost=53 size=34364 card=484)
         50         INDEX RANGE SCAN LINEAGES_PK (cr=10 pr=0 pw=0 time=7 us cost=1 size=7 card=1)(object id 34021)
    1773000         INDEX RANGE SCAN A96_STATEID_IX1 (cr=3221 pr=0 pw=0 time=6810 us cost=32 size=0 card=1774)(object id 35116)
    1773000        TABLE ACCESS BY INDEX ROWID A96 (cr=18990 pr=0 pw=0 time=0 us cost=52 size=82560 card=1290)
         10   VIEW  (cr=216 pr=0 pw=0 time=0 us cost=7 size=47 card=1)
         10    UNION ALL PUSHED PREDICATE  (cr=216 pr=0 pw=0 time=0 us)
          0     NESTED LOOPS ANTI (cr=1 pr=0 pw=0 time=0 us cost=2 size=82 card=1)
          0      TABLE ACCESS BY INDEX ROWID CONNECTION_ATTRIBUTES (cr=1 pr=0 pw=0 time=0 us cost=1 size=78 card=1)
          0       INDEX RANGE SCAN GDB_59_CONNECTIO (cr=1 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 34346)
          0      VIEW PUSHED PREDICATE  VW_NSO_1 (cr=0 pr=0 pw=0 time=0 us cost=1 size=4 card=1)
          0       NESTED LOOPS  (cr=0 pr=0 pw=0 time=0 us cost=1 size=20 card=1)
          0        INDEX RANGE SCAN LINEAGES_PK (cr=0 pr=0 pw=0 time=0 us cost=1 size=7 card=1)(object id 34021)
          0        INDEX UNIQUE SCAN D97_PK (cr=0 pr=0 pw=0 time=0 us cost=0 size=13 card=1)(object id 35127)
         10     HASH JOIN ANTI (cr=215 pr=0 pw=0 time=0 us cost=5 size=55 card=1)
         10      NESTED LOOPS  (cr=35 pr=0 pw=0 time=0 us cost=2 size=29 card=1)
         10       TABLE ACCESS BY INDEX ROWID A97 (cr=25 pr=0 pw=0 time=0 us cost=2 size=22 card=1)
         10        INDEX RANGE SCAN GDB_59_CONNECTIO_A (cr=15 pr=0 pw=0 time=0 us cost=1 size=0 card=1)(object id 35122)
         10       INDEX UNIQUE SCAN LINEAGES_PK (cr=10 pr=0 pw=0 time=0 us cost=0 size=7 card=1)(object id 34021)
          0      VIEW  VW_NSO_2 (cr=180 pr=0 pw=0 time=0 us cost=2 size=26 card=1)
          0       FILTER  (cr=180 pr=0 pw=0 time=0 us)
          0        NESTED LOOPS  (cr=180 pr=0 pw=0 time=0 us cost=2 size=20 card=1)
          0         INDEX FAST FULL SCAN D97_PK (cr=180 pr=0 pw=0 time=0 us cost=2 size=13 card=1)(object id 35127)
          0         INDEX UNIQUE SCAN LINEAGES_PK (cr=0 pr=0 pw=0 time=0 us cost=0 size=7 card=1)(object id 34021)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       2        0.00          0.00
      SQL*Net message from client                     2        0.00          0.00After manually rewrite query in TOAD it produces nested loops on business table and than access v__96, v__97 produce desired quick performance.
    I can use stored outlines but this is the last chance. I am playing with hints right now to produce desired plan with no result yet.
    Does anybody know how to insist Oracle to merge internal views to bigger query block, so Oracle can choose better plan?
    Or any guide what hints to use from ol$hints to get desired result via hints addition to original sql query (thanks God application don't cut hints just pass-through to Oracle)?
    Thanks,
    Sergiy

  • Best Practice - Outer Join between Fact and Dim table

    Hi Gurus,
    Need some advice on the below scenario
    I have an OOTB subject area and we have around 50-60 reports based on it. The related subject area Fact and Dim1 table are having inner join.
    Now I have a scenario for one report where outer join has to be implemented between Fact and Dim1. Here I am against changing the OOTB subject area join as the outer join will impact the performance of other 50-60 reports.
    Can anyone provide any inputs on what is the best way to handle this scenario?
    Thanks

    Ok. I tried this:
    Driving table : Fact, Left outer join -- didnt work.
    Driving table: Dimension D left outer join -- didnt work either
    In either the case, I see physical query as D left outer Join on Fact F. and omitting the rows.
    And then I tried this -
    Driving table: Fact, RIght outer join.
    Now, this is giving me error:
    Sybase][ODBC Driver]Internal Error. [nQSError: 16001] ODBC error state: 00000 code: 30128 message: [Sybase][ODBC Driver]Data overflow. Increase specified column size or buffer size. [nQSError: 16011] ODBC error occurred while executing SQLExtendedFetch to retrieve the results of a SQL statement. (HY000)
    I checked all columns, everything matched with database table type and size.
    I am pulling Fact.account number, Dimension.account name, Fact.Measures. I am seeing this error each time I pull Fact.Account number.

  • Multiple 'logical joins' between a fact table and one dimension table

    It appears that one cannot create multiple ‘logical joins’ between a fact table and one dimension table in OBIEE using the Oracle BI Administration Tool. For example, considering a Business Model with a dimension table TIMES and a fact table FACT containing START_TIME and END_TIME, we would like to create separate logical joins from FACT to TIMES for the START_TIMEs and END_TIMEs? Obviously, the underlying foreign keys can be created, but as far as I can tell the Oracle BI Administration Tool doesn’t support this. The workaround would be to replicate the TIMES table, but that’s ugly.
    I seek an alternative approach.

    Try this. Create an two aliases for the TIMES dimension (Start & End) in the Physical Layer and then remove foreign key to the "Parent" Times dimension. Create the Foreign Key in the Physical Layer to the new aliases and then create the complex joins in the BMM Layer to the new aliases as well. This will allow you to present both dates within the same table in the Presentation Layer. Not the most elegant solution but it works.

  • Can we write a join on a view and a table

    Hi all,
    can we write a join on a view and a table. i got the requirement from my functional people about the following one
    Select CAUFV-AFUNR, CAUFV-AUART, AFVC-VORNR, CAUFV-FTRMI, CRHD-ARBPL
    into <ProOrd>, <OrdTyp>, <Opt>, <RelDat>, <WorCen>
    from CAUFV, AFVC, CRHD
    where CAUFV-WERKS = plant in selection screen
    and CAUFV-AFUNR = production order in selection screen
    and CAUFV-AUART = production order type in selection screen
    and CAUFV-FTRMI = range of release date in selection screen
    and CAUFV-AUFPL = AFVC-AUFPL
    and AFVC-ARBID = CRHD-OBJID
    and CRHD-OBJTY = ‘A’
    here CAUFV is a view and CRHD and AFVC are transperent tables.
    please tell me any feasible solution for this..
    Thanks  in Advance..

    Hi
    Refer these links:
    <u>http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ec84446011d189700000e8322d00/content.htm</u>
    <u>http://www.sap-img.com/abap/what-is-the-different-types-and-usage-of-views.htm</u>
    <u>http://www.karakas-online.de/forum/viewtopic.php?t=730</u>
    Thanks
    Vasudha
    Message was edited by:
            Vasudha L

  • Left outer join on Fact and dimension table.

    Hi all, I have a fact F with account number and few measures as columns.
    I also have a dimension D with account number, account name columns.
    Few account numbers from Fact doesnt exist in Dimension D , but they need to show up in the report though.
    How do I left join Fact and Dimension D in RPD?
    I have this report where I need to show Account Number, Account name, measures.
    If D doesnt have certain account numbers, I need to convert that account number from F as string and show it in the report in account name column.
    Can you pls help.

    Ok. I tried this:
    Driving table : Fact, Left outer join -- didnt work.
    Driving table: Dimension D left outer join -- didnt work either
    In either the case, I see physical query as D left outer Join on Fact F. and omitting the rows.
    And then I tried this -
    Driving table: Fact, RIght outer join.
    Now, this is giving me error:
    Sybase][ODBC Driver]Internal Error. [nQSError: 16001] ODBC error state: 00000 code: 30128 message: [Sybase][ODBC Driver]Data overflow. Increase specified column size or buffer size. [nQSError: 16011] ODBC error occurred while executing SQLExtendedFetch to retrieve the results of a SQL statement. (HY000)
    I checked all columns, everything matched with database table type and size.
    I am pulling Fact.account number, Dimension.account name, Fact.Measures. I am seeing this error each time I pull Fact.Account number.

Maybe you are looking for