Join of Multiple Tables

We are experiencing an unpredictable error in a simple form and have
experimented it in different scenarios it behaves in the same way.
The problem description is as under:
We are using "Join of Multiple Tables" feature of Developer-6i. In our
forms there are two tables e.g. Emp and Dept. We have set all the
properties requiered to do this job inluding:
1. "Query Data Source Name" is set to Emp,Dept.
2. "Where Cluase" is set to Emp.Deptno = Dept.Deptno
3. "DML Target Name" is set to EMP.
4. Manullay created the columns for Dept.Dname.
5. Set the Query-Only Property to Yes.
6. Set the Primary Key Property to Yes for Empno
When we execute this form it performs properly with the normal operations.
It inserts, updates and delete records properly But in the scenario e.g.
when we scroll to 5th or any other record greater this number and
start changing employee name and committing on the each record going
backward. It generates Primary Key Violation errors after updating
4-5 records.
When we locate the error in "Display Error" button it shows the update
statement as "UPDATE EMP SET WHERE ROWID=:1" and there is no "Field=Value"
cluase in the UPDATE statement.

Hi, Mahesh,
So you want only 1 row of output for each distinct combination of currentpress and lastpcirim?  That sounds like a job for GROUP BY.
And you want that row to contain a delimited list of all the different typidcontainers?  That sounds like a job for the aggregate LISTAGG function.
WITH  joined_data  AS
    SELECT DISTINCT
                mst.curepress, mst.lastpcirim, inf.typeidcontainer
    FROM        betmaster mst
    LEFT JOIN   betinfo   inf   ON  TRIM (mst.curepress) = SUBSTR ( TRIM (inf.currentpress)
                                                                  , 1
                                                                  , 3
SELECT    curepress, lastpcirim
,         LISTAGG (typeidcontainer, ', ')
              WITHIN GROUP (ORDER BY  typeidcontainer)   AS container_list
FROM      joined_data
GROUP BY  curepress, lastpcirim
Unfortunately, you can't say LISTAGG (DISTINCT ...), so you still have to get the distinct containers the way you're already doing it.  (Notice that the sub-query is just what you posted.)
Thanks for posting the CREATE TABLE and INSERT statements; that's very helpful.  Don't forget to say which version of Oracle you're using.  LISTAGG was new in Oracle 11.2.
Why not add CHECK constraints (and maybe triggers) to your tables, so that curepress and currentpress are not stored with leading or trailing spaces?  Then you wouldn't need to use TRIM in queries like this, and your code would be simpler and more efficient.

Similar Messages

  • Left outer join using multiple table

    Hi,
    I am trying to use left outer join with multiple tables , the join condition will be based on  PERNR and BEGDA & ENDA for each infotype in selection screen.
      select pa00~pernr pa00~begda pa00~endda pa00~massn pa00~massg pa00~stat2 pa00~aedtm pa00~uname
        pa01~begda pa01~endda pa01~bukrs pa01~persg pa01~persk pa01~mstbr pa01~ename pa01~aedtm pa01~uname
        pa02~begda pa02~endda pa02~nachn pa02~vorna pa02~midnm pa02~aedtm pa02~uname
        pa016~begda pa016~endda pa016~cttyp pa016~aedtm pa016~uname
        into CORRESPONDING FIELDS OF TABLE i_pall
        from  ( PA0000 as pa00 left OUTER JOIN pa0001 as pa01 on pa00~pernr = pa01~pernr )
        left OUTER JOIN pa0002 as pa02 on pa00~pernr eq pa02~pernr )
        left OUTER JOIN  pa0016 as pa016 on pa00~pernr eq pa016~pernr )
        where pa00~pernr in S_pernr
        AND pa00~begda in s_bg0000
        and pa00~endda in s_nd0000.
    but this fails  to fetch the value of begda enda from each pa0000,pa0001,pa0002,pa0016.
    Please help!
    Monirul

    Why don't you use the standard logical database PNPCE and then Provide statement?

  • Oracle outer join on  multiple tables throws error

    Hi ,
    We are using ansi joins with outer joins on multiple tables in oracle 9i.
    Now these queries have to be used in Oracle8i.
    Since Oracle8i does not support ansi sql we are replacing the ansi sql queries with the oracle joins.
    On trying the same we found that the following query
    select *from tab1 a, tab2 b, tab3 c where a.c1 = b.col1(+) and c.c2 = b.col2 (+)
    throws the error
    ORA-01417: a table may be outer joined to at most one other table.
    Is there a way to simulate this query without using the outer joins on multiple tables?
    thanks

    Try writing the query in this form:
    select * from
    (select t1.col1, t1.col2
    from schema.table1 t1, schema.table2 t2
    where t1.col1 = t2.col1(+)) t4,
    schema.table3 t3 where t4.col2 = t3.col2(+)
    In the subquery, you will have to list all the columns you want to see, and you will need to provide unique aliases for any columns with duplicate names. I tested this on 9i, and don't have an 8i system to work with, so I hope this helps.

  • Outer join on multiple tables

    Hi All,
    I need to create multiple outer join in Discoverer.
    My requirements is like this
    I have a report where in I show the sales of components. I have Year as page item in Discoverer cross tab.
    I have 2 years in my year table, 1999 and 2000
    in the components table I have 3 components, X, Y, Z
    In the fact table, I have 5 records as below
    YEAR     PRODUCT     AMOUNT
    1999     X     100
    1999     Y     200
    1999     Z     300
    2000     X     400
    2000     Y     500
    Now with this data, when I create a cross tab with year as page item, I get the following output on selecting 1999 as year in page item,
    component     Amount SUM
    X     $100
    Y     $200
    Z     $300
    similarly when I get report for 2000 it will be as follows
    component     Amount SUM
    X     $400
    Y     $500
    Now I want some way to get a report as below for 2000 and similar cases
    component     Amount SUM
    X     400
    Y     500
    Z     0
    Can some body help me??
    Thanks,

    Hi Mrutyunjay,
    If you keep the query as described by Csaba but leave out time_period.year from the SELECT and GROUP BY list. In addition, replace the SUM(...) function with the following expression.
    SUM (CASE WHEN <condition> THEN fact_tab.amount ELSE 0 END)
    Where <condition> will be along the lines of 'time_period.year = 1999'.
    This will give you the result you require.
    Do be aware that this will force Oracle to do a full scan on the fact_tab table. This may render the solution unworkable.
    Cheers,
    denty.

  • Duplicates in sql query out put when qury has join on multiple tables.

    I have the below query whcih is returning 2 duplicate records.
    Is there any way how to figure out from which table is causing the duplicate?
    There are so many inline view and join conditions in this query .
    in waht join conditions i need to look into mainly?
    or how to find the whcih table is causing the duplicate when we have multimple joins?
    this is really bothering me a lot .please help me with this.
    SELECT       'BCCALGLB'            model_cd,
                         fi_instrument_id,
                         fmr_cusip             instrument_id,
                         price,
                         '27-FEB-2013'          pricing_dt,
                         currency_cd
                         FROM         (SELECT  II.fmr_cusip,
                                  IAI.fi_instrument_id,
                                  IP.price,
                                  IP.currency_cd
                          FROM    (SELECT  IdxHldg.vendor_instrument_id,
                                           IdxHldg.index_cd,
                                           IdxHldg.data_source_cd,
                                           GM.member_rank,
                                           RANK () OVER (PARTITION BY  IdxHldg.vendor_instrument_id
                                                         ORDER BY      GM.member_rank  ASC)  priority
                                   FROM    (SELECT  IBH.vendor_instrument_id,
                                                    IBH.index_cd,
                                                    IBH.data_source_cd
                                            FROM    fi_idx_benchmark_holdings  IBH
                                            WHERE   IBH.pricing_dt = '27-FEB-2013'
                                            UNION
                                            SELECT  IFH.vendor_instrument_id,
                                                    IFH.index_cd,
                                                    IFH.data_source_cd
                                            FROM    fi_idx_forward_holdings  IFH
                                            WHERE   IFH.pricing_dt = '27-FEB-2013'
                                           )  IdxHldg,
                                           fi_group_member  GM
                                   WHERE   GM.group_cd      = 'BCGLOBALIDX'
                                   AND     GM.purpose_cd    = 'GLOBALIDX'
                                   AND     IdxHldg.index_cd = GM.character_val
                                  )  BCIdxHldg,
                                  fi_idx_instrument  II,
                                  fi_idx_price  IP,
                                  instrument_alternate_id  IAI,
                                  instrument  I
                          WHERE   BCIdxHldg.priority                  =      1
                          AND     BCIdxHldg.data_source_cd            =      II.data_source_cd
                          AND     BCIdxHldg.vendor_instrument_id      =      II.vendor_instrument_id
                          AND     II.data_source_cd                   =      IP.data_source_cd
                          AND     II.vendor_instrument_id             =      IP.vendor_instrument_id
                          AND     IP.currency_cd                      =      I.currency_cd
                          AND     IP.pricing_dt                       =      '27-FEB-2013'
                          AND     II.fmr_cusip                        =      IAI.alternate_id
                          AND     IAI.alternate_id_type_code          =      'FMR_CUSIP'
                          AND     IAI.fi_instrument_id                =      I.fi_instrument_id
                          AND     NVL (I.instrument_domain_cd, 'XXX') NOT IN ('MBS', 'MGEN')
                          AND     NVL (I.instrument_type_cd, 'XXX')   !=     'CMBS'
                          AND     ((I.currency_cd                     NOT IN ('CAD', 'USD'))
                                   OR
                                   (EXISTS (SELECT  1
                                            FROM    adm_calendar_date  ACD,
                                                    ctry_curr_link  CCL
                                            WHERE   TO_DATE (ACD.calendar_yyyymmdd, 'YYYYMMDD') = '27-FEB-2013'
                                            AND     ACD.calendar_origin_cd                      = 'EXCHANGE'
                                            AND     ACD.calendar_type_cd                        = 'BUSINESS'
                                            AND     ACD.geography_cd                            = CCL.ctry_cd
                                            AND     CCL.link_typ                                = 'ISS'
                                            AND     CCL.curr_cd                                 = I.currency_cd
                                            AND     ACD.business_day_ind                        = 'Y'))))

    Hi,
    953115 wrote:
    I have the below query whcih is returning 2 duplicate records.
    Is there any way how to figure out from which table is causing the duplicate?
    There are so many inline view and join conditions in this query .
    in waht join conditions i need to look into mainly?
    or how to find the whcih table is causing the duplicate when we have multimple joins?What has changed since the last time the query ran correctly? (It must have run correctly at some point. You didn't just write a query that big all at once without testing each individual part, did you?)
    Find a small set of sample data that causes the problem. Create and work with tables that have only that small set of data.
    Take baby steps. Start with the most deeply nested sub-query. and simplify it so that it uses only 1 table: comment out all references to other tables. Does it produce exactly what you're expecting, especially the number of rows?
    If not, post just that one sub-query, your sample data, and the output you need (but are not getting) from that sub-query.
    If it does work, then un-comment the other tables, 1 at a time. Test after each one. If the revised sub-query starts acting strangely, then you have a good clue about what's causing the problem, but if you can't figure it out, post that much of the query, your sample data (CREATE TABLE and INSERT statements) and the expected results from the code you posted.
    If then entire sub-query works, then add the next super-query, and repeat the testing process.
    What is the data type of ibh.pricing_dt?
    If its a DATE, then don't compare it to a VARCHAR2, as you're doing in this line:
    IBH.pricing_dt = '27-FEB-2013'Use TO_DATE to convert a string, such as '27-FEB-2013', to a DATE.
    If it's not a DATE (or TIMESTAMP), then you have an even more serious problem.

  • JDBC adapter to SAP: select & join from multiple tables ???

    Hello,
    I have a task to get an aggregating information from two tables and send it into SAP.
    I use XI JDBC sender adapter to access to MSSQL DB.
    I know how to construct SQL quiery:
    (something like that)
    SELECT  table1.Date  SUM(table1.sum) from table1
    INNER JOIN table2
    ON table1.Number = table2.Number
    But I don't understand how to construct  Data Type for this complex select operator?
    How does it look like?
    Where to store and how to map the selected data?
    Please give me an example or an advice.
    Thank You.

    Hi,
    Use your structure like this.
    <StatementName4>
    <dbTableName action=”SELECT”>
    <table>realDbTableName</table>
    <access>
    <col1/>
    <col2/>
    <col3/>
    </access>
    <key1>
    <col2>val2old</col2>
    <col4>val4</col4>
    </key1>
    <key2>
    <col2>val2old2</col2>
    </key2>
    </dbTableName>
    </StatementName4>
    action=SELECT
    Statements with this action cause existing table values to be selected. Therefore, the statement corresponds to an SQL SELECT statement.
    The <access> block contains the column names to be selected, a <key> element contains the columns whose values must be identical with the specified value to get the new column values. The name of the <key> element is arbitrary. Column values within a <key> element are combined with a logical AND; different <key> elements are combined with a logical OR.
    A statement with the action SELECT must have exactly one <access> element. The number of <key> elements with arbitrary names is not restricted.
    The corresponding SQL statement for StatementName4 in the example above is as follows:
    SELECT col1,col2,col3 FROM dbTableName WHERE ((col2=’val2old’ AND col4=’val4’) OR (col2=’val2old2’))
    If there is no <key> element, or if there is a <key> element but it is empty, then no condition is specified and the entire table is to be selected. This may not be permitted by the configuration of the JDBC adapter for security reasons and will therefore result in an error during message processing and an appropriate error message.
    The response document contains the result of the action in XML format as follows:
    <row>
    <column1>value11</column1>
    <column2>value12</column2>
    </row>
    <row>
    <column1>valueN1</column1>
    <column2>valueN2</column2>
    </row>
    This will help you.
    regards
    Aashish Sinha
    PS : reward points if helpful

  • Update query to fixed value while joining to multiple tables

    We have a lot of phone country codes that are blank or incorrect. For example, Egypt's phone country code is 20. I want to update the phone country code to 20 but only if the country in the locations table = 'EG' and there is in fact a location record (it's possible a party has a phone number but not a physical address in which case there is insufficient information to update the phone country code to 20. Here's what I have thus far which does not work.
    update ar.hz_contact_points hzcp
    set hzcp.phone_country_code = 20
    join ar.hz_party_sites hzps on hzps.PARTY_ID = hzcp.OWNER_TABLE_ID
    join ar.hz_locations hzl on hzl.LOCATION_ID = hzps.location_id
    where 1=1
    and hzcp.owner_table_name = 'HZ_PARTIES'
    and hzl.location_id = hzps.location_id
    and hzl.country = 'EG'
    and hzcp.phone_country_code not like '20'
    and hzcp.contact_point_id = '54060443' --(Note I'm limiting it just to one record for testing.)Thanks in advance!

    Just slightly different
    update ar.hz_contact_points hzcp
       set hzcp.phone_country_code = 20
    where hzcp.phone_country_code != 20
       and hzcp.owner_table_name = 'HZ_PARTIES'
       and hzcp.contact_point_id = 54060443   --(Note I'm limiting it just to one record for testing.)
       and exists(select null
                    from ar.hz_party_sites hzps,
                         ar.hz_locations hzl
                   where hzps.PARTY_ID = hzcp.OWNER_TABLE_ID
                     and hzl.location_id = hzps.location_id
                     and hzl.country = 'EG'
                 )Regards
    Etbin

  • Join multiple tables across separate databases

    I needed to perform a join on multiple tables in two separate databases. I am using Sybase ASE 12.5 and jConnect 5.5 JDBC driver.
    Table A is in DB1 and Table B is in DB2. Both DB1 and DB2 reside on the same database server.
    I have set up JNDI bound datasources DS1 for DB1 and DS2 for DB2.
    If the queries involved single tables or multiple tables within the same database, it is simple. But I am not seeing any way where I can perform a join between Tables A and B, which reside in separate databases. The datasources DS1 and DS2 are associated with DB1 and DB2 respectively, so I am not sure if there is anything like performing joins using two data sources.
    One alternative I am facing is using a stored procedure in one database refer the table in the other database, for the join. But I may not be allowed to modify the database; currently, I am allowed to perform READ-ONLY queries.
    So I am looking for any and all options. Please advice.
    Thanks!

    Two choices..
    One find the syntax in DB2 that allows you to do what you want in there. That would often be somelike...
    select a.myfield
    from database1.table1 a, database2.table2 b
    where a.id = b.id
    Obviously the database itself must support this. If it doesn't then you have choice two.
    You extract the data from database1 using java for table1.
    You extract the data from database2 using java for table2.
    You write java code that merges the data from both sources.

  • Join Multiple Tables in Forms 9i

    I am attempting to create a tabular form in 9i using two tables. The tables have a one-to-many relationship. The Detail table is the main table for the form and I wish to pull in a column from the master table.
    It is similar to the example provided in the on-line help for FORMS 9i 'JOIN of Multiple Tables'. I have gone through all the steps provided. The form compiles OK, however, when I execute_query I get the following error message 'FRM-40505: ORACLE error: unable to perform query.' It does not matter whether the form is of type form or tabular.
    If I create a tabular form using the DETAIL table ONLY and then execute_query - the form works correctly.
    Thank you in advance of any help
    Michael Redford

    Andrew, Thank you for your reply.
    I concur as I have double checked everything and the Query now works. However I still have a problem.
    The error 'FRM-40657 Record changed or deleted by another user' appears as soon as I attempt to change a users record. This form and system is still in development. No other developers/users have access to the tables or forms.
    If I remove all references to the joined table then I can update the same field with no errors.
    I am trying to display the users name where the users name is not a field on the current table.(similar to creating a form for Employees details and displaying the Department Name for each employee.)
    Re: Display Error. We have very recently upgraded from Forms 6i to Forms9i. In 6i we used the Display Error in the Runtime Previewer to debug a Form. Forms 9i runs the form on the web and I'm not sure if the 'Display Error' feature is still available.
    Thank you
    Michael Redford

  • Using table comparison can we use multiple tables as source?

    Using table comparison can we use multiple tables as source?
    Thank you very much for the helpful info.

    Table Comparison
    1) Input Data coming in
    2) Comparison table (table to which the data is compared)
    3) Output (input rows with respective opcodes based on the comparison result of input dataset with the comparison table)
    If your question is whether table comparison can accept union/join of multiple table sources, you can achieve by using merge/query transforms and then feeding to table comparison. Here, you have to be careful about choosing the primary keys inside table comparison

  • Unable to join 3 fact tables in obiee data model.

    Hi,
    I am unable to join the 3 fact tables in obiee rpd. If I join with 2 fact tables I got the data in repors, Once I add the one more fact table and join with related dimensions, I am getting nodata error. I am following all joins keys as per datamodel, I am able to see the data in database. anyone pls give me the solution. Thanks in advance.
    Edited by: 1007582 on May 23, 2013 2:17 AM

    Can you please give some more detail as in what you have model in RPD;
    For example, if There are 3 Fact table F1, F2, F3 and two Dimesion Confirmed_D1, Non_Conf_D2. Confirmed_D1 is joined to all three fact tables and Non_Conf_D2 is joined to F2.
    Now to implement this model we have to set the logical content level in BMM layer for Non_Conf_D2 in F1 & F2 to Total*. After this only we can report on Confirmed_D1, Non_Conf_D2, F1, F2, F3 whithout any error.
    Sometime join with multiple table can also result in No Data, since the join conditions filters out the result data.
    Please mark helpful or correct.
    Regards,
    Kashinath

  • CacheStore implementation for multiple table

    Hi,
    Is it possible to configure the <cachestore-scheme> element or implement cachestore to get data from multiple
    table. Currently the xml and cachestore sample in the tutorial is configured for single table.
    Thanks
    -thiru

    hello Aleks,
    "As Rob mentioned, you can implement CacheStore to do pretty much anything you want: do a join across multiple tables, execute multiple queries to get data from multiple tables, or even access non-database system, such as a legacy system or a web service in order to retrieve data. Coherence really doesn't care how you implement your cache store and where you get the data from, as long as you return a single object for the load method that needs to be inserted into the cache that the cache store is configured for (or in the case of loadAll, multiple objects in a map)."
    as long as you return a single object for the load method that needs to be inserted into the cache that the cache store is configured for (or in the case of loadAll, multiple objects in a map) -> when you say this.. how can we configure the cache store to be configured for an object?
    I am new to the coherence. Correct me if I am wrong.
    because as I see cache-store will be configure with cache right?
    <cachestore-scheme>
      <class-scheme>
       <class-name>com.company.MyCacheStore</class-name>
          <init-params>
             <init-param>
                <param-type>java.lang.String</param-type>
                <param-value>cache-info</param-value>
             </init-param>
          </init-params>
      </class-scheme>
    </cachestore-scheme>
    Here it is referring to the cache "cache-info" and in the cache "cache-info", I can have Object1 with Key1, Object2 with Key2 and Object3 with Key3, As long as I return any object (object1,object2,object3) it is fine right.
    My cache have 3 objects Object1,Object2 and Object3,
    In cache-store, based on type of the Key I will perform the processing and return the corresponding object. Is it wrong?
    Please comment.
    Thanks in Advance.

  • Context index can't be used in complicated multiple tables join?

    hello
    thank you for view this page.
    i have a comlicated sql :
    SELECT count(*)
    from
    ((app_AssetBasicInfo left join app_AssetBasicInfoExt on
    app_AssetBasicInfo.id=app_AssetBasicInfoExt.id) left join
    (app_AssetCustominfo1 left join app_AssetCustominfoExt1 on
    app_AssetCustominfo1.id=app_AssetCustominfoExt1.id) on
    app_AssetBasicInfo.id=app_AssetCustominfo1.id) WHERE
    app_AssetBasicInfo.CategoryID=1 AND Del_tag=0 and contains(description,'department')>0;
    the table app_AssetBasicInfo and app_AssetBasicInfoExt have multiple columns and large recoord size. i create a context index on app_assetbasicinfoext(description) which description is 4000 varchar2.
    but the sql doesn't use context index. i suspect that the complicated multiple table join can't use context index? does it correct?
    thanks very much!

    Could you please post an explain plan? I'm not quite sure what is the issue.

  • How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?

    1. How to create an explain plan with rowsource statistics for a complex query that include multiple table joins ?
    When multiple tables are involved , and the actual number of rows returned is more than what the explain plan tells. How can I find out what change is needed  in the stat plan  ?
    2. Does rowsource statistics gives some kind of  understanding of Extended stats ?

    You can get Row Source Statistics only *after* the SQL has been executed.  An Explain Plan midway cannot give you row source statistics.
    To get row source statistics either set STATISTICS_LEVEL='ALL'  in the session that executes theSQL OR use the Hint "gather_plan_statistics"  in the SQL being executed.
    Then use dbms_xplan.display_cursor
    Hemant K Chitale

  • LEFT OUTER JOIN multiple tables - using the 9i syntax

    I've always written my queries using the (+) operator for outer joins. I want to start using the new ANSI standard available in 9i. I can do it when I'm joining two tables in a simple query, but how does it work when I am joining multiple tables?
    Here is an example of some SQL that works with the (+) outer join syntax. How can I convert this to use the LEFT OUTER JOIN syntax?
    SELECT *
    FROM audit_entry aue,
    audit_table aut,
    audit_statement aus,
    audit_row aur,
    audit_row_pkey aup1,
    audit_row_pkey aup2
    WHERE aue.audit_entry_id = aus.audit_entry_id
    AND aut.table_name = 'TEST_AUDITING'
    AND aut.table_owner = 'CLA_JOURNAL'
    AND aus.audit_table_id = aut.audit_table_id
    AND aur.audit_statement_id (+) = aus.audit_statement_id
    AND aup1.audit_row_id (+) = aur.audit_row_id
    AND aup1.pk_column_name (+) = 'TEST_AUDTING_PK_1'
    AND aup2.audit_row_id (+) = aur.audit_row_id
    AND aup2.pk_column_name (+) = 'TEST_AUDITING_PK_2'
    I can join audit_statement to audit_entry easy enough, but then I want to join audit_table to audit_statement, how do I do that, do I start nesting the join statements?
    Thanks
    Richard

    Thanks for getting back so quickly, I have tried the suggested SQL with mixed results:
    SELECT COUNT(*)
    FROM audit_entry aue
    JOIN audit_statement aus ON aue.audit_entry_id = aus.audit_entry_id
    JOIN audit_table aut ON aus.audit_table_id = aut.audit_table_id
    RIGHT OUTER JOIN audit_row aur ON aur.audit_statement_id = aus.audit_statement_id
    RIGHT OUTER JOIN audit_row_pkey aup1 ON aup1.audit_row_id = aur.audit_row_id
    RIGHT OUTER JOIN audit_row_pkey aup2 ON aup2.audit_row_id = aur.audit_row_id
    WHERE aut.table_name = 'TEST_AUDITING_TWO'
    AND aut.table_owner = 'CLA_JOURNAL'
    AND aup1.pk_column_name = 'TEST_AUDTING_PK_1'
    AND aup2.pk_column_name = 'TEST_AUDITING_PK_2'
    I had to change the order slightly, between the first two JOINs but otherwise it executed OK. My problem is, it should only return 175 rows but its returning 30625 rows. If I comment out the second reference to audit_row_pkey I get the expected result:
    SELECT COUNT(*)
    FROM audit_entry aue
    JOIN audit_statement aus ON aue.audit_entry_id = aus.audit_entry_id
    JOIN audit_table aut ON aus.audit_table_id = aut.audit_table_id
    RIGHT OUTER JOIN audit_row aur ON aur.audit_statement_id = aus.audit_statement_id
    RIGHT OUTER JOIN audit_row_pkey aup1 ON aup1.audit_row_id = aur.audit_row_id
    --RIGHT OUTER JOIN audit_row_pkey aup2 ON aup2.audit_row_id = aur.audit_row_id
    WHERE aut.table_name = 'TEST_AUDITING_TWO'
    AND aut.table_owner = 'CLA_JOURNAL'
    AND aup1.pk_column_name = 'TEST_AUDTING_PK_1'
    --AND aup2.pk_column_name = 'TEST_AUDITING_PK_2'
    It looks the same condition is being used in each case but why do I suddenly get so many rows - its joining differently somehow. It must be to do with the order, do I need to bracket the query?
    Thanks again
    Richard

Maybe you are looking for

  • Error Calling Data Provider for Return PO in Me21N Message Number FES011

    Hi Experts, I am trying to create a Return PO using ME21N. Im giving all the parameters and values. But While saving its generating an Error. it states "Error calling Data Provider". Message No. FES011 What could be the possible error . Any clues? Th

  • How to uninstall old iphoto and reinstall it in old Mac Pro (new iphoto not compatible)

    I can't install the new iPhoto in my Mac Pro (2006-2007 model) but my old iPhoto is not working, won't open and I can't uninstall it and install it again. Any ideas how to do it? Thanks

  • Binding Shared Variable to Source

    Dear all, I'm currently working on a project that requires the use of shared variables. The shared variables will be network published and programmatically created using properties nodes. However I encounter one error and one problem in the process o

  • Firefox/Windows: some forums, strange behaviour on Intel/Mac

    At the site: http://www.elderscrolls.com/forums... No-one's avatars show up in Firefox for Windows. But they do in IE. I have my personal settings for avatars set to enable. Safari and Firefox in the Mac environment show avatars at this site okay. I'

  • Will Apple Air (2011) work with BenQ W1070

    I want to be able to display home made videos and photos to reasonable sized groups of people, so I need to use a projector rather than a screen. For this purpose and a couple of others my research shows the BenQ W1070 to be the right balance of func