Oracle OUTER JOIN on more than one table

Hi!
Friends, please help with this urgent problem: How can an outer join be written on more than one table?
An SQL Server query:
SELECT * from a INNER JOIN b on a.id = b.id LEFT OUTER JOIN c ON c.id = a.id AND c.id = b.id
works fine with SQL SERVER
But Oracle query:
SELECT * from a,b,c WHERE a.id = b.id AND a.id = c.id (+) AND b.id = c.id (+)
gives an error: OUTER JOIN cannot be used on more than one table? Why?
I use OracleDriver from classes12.zip to connect to Oracle8i database.
Please, help!

The Oracle 8i and later SQL reference reads that the following "join_types" are supported and under this syntax it does not limit the LEFT OUTER JOIN (syntax the same as SQLServer example in original note) to two tables as implied in these notes:
The join_type indicates the kind of join being performed:
Specify INNER to indicate explicitly that an inner join is being performed. This is the default.
Specify RIGHT to indicate a right outer join.
Specify LEFT to indicate a left outer join.
Specify FULL to indicate a full or two-sided outer join. In addition to the inner join, rows from both tables that have not been returned in the result of the inner join will be preserved and extended with nulls.
You can specify the optional OUTER keyword following RIGHT, LEFT, or FULL to explicitly clarify that an outer join is being performed.

Similar Messages

  • How to use left outer join on more than one table (source)

    Hi all,
    In our project we are converting the Unix shell & SQL scripts into OWB mappings. We are facing problem converting left outer join in OWB. here is one of the example. i have just pasted the FROM and where condition.
    FROM ym_scr t1, branch_finmonth t3
    LEFT OUTER JOIN item_image t2
    ON (t1.branch_no = t2.branch_no
    AND t1.item_no = t2.item_no
    AND t3.to_date between t2.tran_dt and t2.to_dt
    AND t2.to_dt >= '$start_images' ) <<<========= '$start_images' THIS COMES FROM THE UNIX VARAIBLE ,
    We converts the same when we are putting it in OWB join Operator
    INGRP1.branch_no = INGRP2.branch_no(+)
    AND INGRP1.item_no = INGRP2.item_no(+)
    AND INGRP3.to_date between t2.tran_dt and t2.to_dt
    AND INGRP2.to_dt >= INGRP2.start_images
    But as you see in the OWB opreator we can put left join with INGRP1 with INGRP2.
    We can not make same join with INGRP3 & INGRP4 , becoz it failed saying "you cannot left outer join on more than one table/source".
    so overall this OWB code makes incomplete left outer join as per the above ANSI SQL join in Oracle.
    Bcoz of the problem we are getting less number of rows...........
    SO please please help me on this
    Regards
    Ashok

    Hi.
    I know this topic is here for a while now, but I had the same problem today, searched for help and didn´t find anything.
    Later I figured out how to do this.
    You just have to put the (+) one time, and the OWB converts in an LEFT OUTER JOIN statement.
    For this case, all you have to do is:
    ( INGRP1.branch_no = INGRP2.branch_no(+) AND INGRP1.item_no = INGRP2.item_no AND INGRP2.to_dt >= INGRP2.start_images )
    Regards,
    Godoy

  • Outer join on more than 2 tables

    I have difficulties joining more than 2 tables with Oracle 8.1.7. How can I solve this problem?
    SQL> select
    2 G.NOM_GARE, F.VOIE
    3 FROM FIN_POSTE F, TYPE_GARE G,
    4 ( SELECT MATRICULE, RED_CPT1 FROM REDDITION,
    5 ( SELECT SUM( PRIX_TOTAL ) CR, MATRICULE FROM TRANSACTION
    6 GROUP BY MATRICULE
    7 ) CASH_REV
    8 WHERE
    9 R.MATRICULE = CASH_REV.MATRICULE(+)
    10 ) R
    11 WHERE
    12 F.ID_GARE = G.ID_GARE(+)
    13 AND
    14 TRUNC( F.DATE_DEBUT_POSTE, 'MI' ) >= TO_DATE( '20030623 05:00', 'YYYYMMDD HH24:MI' )
    15 AND
    16 TRUNC( F.DATE_DEBUT_POSTE, 'MI' ) <= TO_DATE( '20030624 08:00', 'YYYYMMDD HH24:MI' )
    17 ORDER BY G.NOM_GARE,
    18 F.VOIE,
    19 F.MATRICULE,
    20 F.DATE_DEBUT_POSTE;
    R.MATRICULE = CASH_REV.MATRICULE(+)
    Hiba a(z) 9. sorban:
    ORA-00904: nem megengedett oszlopn�v

    It appears that you are using R as a alias for one of the in-line views when it should probably be aliasing the reddition table ?
    R is currently being referenced inside the in-line view for which it is an alias, which doesn't look right.

  • Left Outer Join with more than two tables in both CR 8.5 and XIR2

    I am trying to create a report and I have tried two versions of Crystal but I ultimately need the report in CR8.5 for compatibility with the client's system.  I think I am starting to figure out what might be wrong and it might be my understanding of SQL, but I can't see why someone hasn't needed this in the past. Ultimately I want to see all projects and any journal entry that might be posted for that project.
    Database is MySQL 5.0.38 and using MySQL ODBC driver 3.51.19.
    Project header table information will be populated. Each line item on a journal entry can be tagged with the project ID. But for me to pull the journal entry date I need also to link to a third table for the journal entry header info.
    I want to see all projects, whether a journal entry has been posted or not.
    So the links are like this
    ProjectHeader --->Left Outer Join ---> JELines ---> Inner Join ---> JEHeader
    I think in this scenerio Crystal is treating the LOJ as an IJ.
    I created two brand new reports today, one in CR8.5 and one in CR XIR2. Once I edited the automatic CR8.5 SQL statement (which I have been doing for years, usually without problem), they both ran properly. I linked customers to their invoices. Customers without invoices showed properly. But then I linked the invoices to the payments of the invoices and immediately lost customers without orders in both reports.
    So apparently only two tables are allowed in Outer Joins. Does this make sense?  I checked out the w3schools tutorial on SQL and it doesn't mention this limitation and I can't find anywhere else that it specifically indicates this but all samples of code I have seen only show two tables.  I just thought for presentation as a sample that was easiest to understand and we could expand as necessary.
    If this is correct, how does one go about accounting for this kind of thing?  One solution that goes through my mind is creating a view at the database level for the link between journal entry lines and journal entry headers.  Would this be a good solution under normal circumstances?
    A second option that I had to implement because of timelines, is to use a subreport linked to the main report through the project ID to pull the information for the journal entries and just pass the totals I need to the main report through a shared variable.
    These aren't normal circumstances because I don't have access to the database so I can't create the view.  I have come across this concept several times and I have been able to use subreports to solve it but I am trying to find a better solution for the future as sometimes subreports can be slow.  So are there any alternatives I have not considered here?
    TIA rasinc

    So after some more work and another post.  I was able to get this to work.
    Items disappear when linking to another table
    My issues were two fold.  I was selecting on the tables on the right-side of the original Inner Join.  However, I was checking for Nulls.  This apparently is correct but you must check for the Nulls first eg. (IsNull (JEHeader.Field1) OR JEHeader.Field1 <= 100).  I had my original statement reversed checking for <= 100 before checking for Nulls.
    I also did not set all links to be Left Outer Join.  I had the Inner Join.  I actually have about 6 tables in this report so all the links need to be set Outer Join.  So this now seems to be corrected.
    Thanks

  • Want to Know how to Join more than One Table

    I want to SHOW search results based on the search conditions user enters the form (eg: oracle advance search form OTN)
    In this case i have to link more than one table and i have fetch the query results based on the user entered conditions in the search form.
    can you please guide/help me in how to write/map this query using TOPLINK API.
    my query should be like this:
    SELECT A.ORDER_NUMBER, B.SAPORDER_NUMBER, C.CUSTOMER_NAME FROM DEAL_QUOTE A, DEAL_SAPORDER B, DEAL_CUSTOMER C
    WHERE A.DEAL_QUOTE_ID=B.DEAL_QUOTE_ID AND B.START_DATE = C.START_DATE AND C.END_DATE=B.END_DATE
    expecting your valuable reply.
    Thanks in advance
    Regards
    babu

    Im not sure this is what you wanted, but couldn't you use a named query in TopLink and then use ADF to display the results?

  • Network or database calls are made when joining more than one table

    Hi Friends,
    could anybody please let me know how may networks are called when joining more than one table.
    Thanks
    Rinky

    Hi Rinky,
      Normally when a JOIN between two database tables is made then following steps occur:-
    1) The control goes to database. Based on the JOINING and WHERE condition, an internal table is created in the DATABASE only which is filled. So here the computation is done at DATABASE level.
    2) Once the internal table is filled at database level, it is sent back to the application level.
    A Join operation normally minimizes the round trips to the database as most of the computation is done at database level only and results sent back to the Application layer.
    <b>Thus for a simple JOIN OPERATION makes a single DATABASE call.</b>
    NOTE: If you are satisfied with the explanation, then please reward points
               accordingly :).
    Thanks and regards,
    Ravi .

  • How to delete the double records connected to one or more than one tables in SQL 2008?

    Hi
    Can anyone please help me with the SQL query. I Im having a table called People with columns names: personno., lastname, firstname and so on. The personno. is having duplicate records,so all the duplicate records i have written with "double" in
    the beginning of the numbers. I tried deleting these double records but they are linked to one or more than one tables. I have to find out, all the tables blocking the deleting of double person. And then create select statements which creates update statements
    in order to replace the current id of double person with substitute id. (The personno. is in the form of id's in the database)
    Thanks

    You should not append "double" in the personno. When we append it will not be able to join or relate to other table. Keep the id as it is and use another field(STATUS) to mark as duplicate. Also we will require another field(PRIMARYID) against
    those duplicate rows i.e the main or the primary personno.
    SELECT * FROM OtherTable a INNER JOIN
    (SELECT personno, status, primaryid FROM PEOPLE WHERE status = 'Duplicate') b
    ON a.personno = b.personno
    UPDATE OtherTable SET personno = b.primaryid
    FROM OtherTable a INNER JOIN
    (SELECT personno, status, primaryid FROM PEOPLE WHERE status = 'Duplicate') b
    ON a.personno = b.personno
    NOTE: Please take backup before applying the query. This is not tested.
    Regards, RSingh

  • JDBC-XI-FILE scenario. How to extract data from more than one table in JDBC

    Hi,
    I was asked a question like in JDBC-XI-FILE scenario........ How to extract data from more than one tables (i.e from JDBC system) ?? What is the logic to do the same ??
    I am not sure whether this is a valid question..........but any help in this regards is highly appreciated.
    Regards
    Kumar

    HI,
    Yes it can be possible ,please see the following links
    JDBC  Receiver with Oracle Stored Procedures
    configuring jdbc adapter with multiple tables
    RFC -> XI -> JDBC Scenario Updating Multiple Tables
    /people/alessandro.berta/blog/2005/10/04/save-time-with-generalized-jdbc-datatypes
    JDBC Adapter multiple Selects
    https://www.sdn.sap.com/irj/sdn/advancedsearch?query=jdbc%20with%20multiple%20tables&cat=sdn_all
    Regards
    Chilla..

  • Update in JDBC Sender adapter for more than one table

    Dear Friends,
              I have to select more than one table in the JDBC sender using the join condition. But i found that update statement is also mandatory in the sender comm channel. I am not going to update any flag after the select but as it is mandatory, i have decided to use the following update statement which wont effect the existing data UPDATE <tablename> set flag = ' ' where flag = ' '.
    But in my case i have 3 tables, do i need to update stmts for all the three tables.
    if yes how can i do the same.
    plz revert back i u couldnt get the queries.
    Thanks
    Prem

    HI
    UPDATE T1
    Set T1.flag =1
    where T1.columnA=value1 and T2.columnB=value2
    where T1 and T2 are tables in the same database,
    and the values (value1 and value 2 ) are provided to XI by SAP based on which the flag need to be updated in T1
    write a stored procedure specifying the join and call it in XI.
    For doing it in SQL statement only reffer to the below link ..sur you will get help .
    Multiple records update using JDBC
    Regard's
    Chetan Ahuja

  • Value Set Use More Than One table

    folks, is there a way to use more than one table in the value set of type table?

    ok if i want to create a view and then when i'm trying to create a table value set. what application should i be selecting? i have created my view in apps schema. if i look in application object library then i do not see it in the list. So i need to register this view? and i think we could not register the views. We could only register tables in apps.Yes you can -- In the Value Sets form (Edit Information button), you can set the view name in the "Table Name" field, and write a (Where/Order by) condition in the same window.
    Oracle Applications Flexfields Guide -- R12
    http://download.oracle.com/docs/cd/B53825_03/current/acrobat/121flexug.pdf
    Oracle Applications Flexfields Guide -- 11i
    http://download.oracle.com/docs/cd/B25516_18/current/acrobat/115flexug.pdf
    Thanks,
    Hussein

  • Persisting CMP bean over more than one table

    Hello,
    I was wondering if it is possible to persist an Entity Bean over more than
    one table using CMP. For example 3 attributes go in table A and 2 attributes
    go in table B.
    I can see this might come in handy when having some kind of inheritance in
    your architecture.
    Thanks,
    Rein Reezigt

    CMP are based on one DB object however object could be a database table or a
    view. You can create a view and base your bean on that view. This is mostly
    useful for read-only entity beans that just do select queries because databases
    have all kind of different restrictions on update froma view, ( for example
    ORACLE allows update to only one table in view). However in case you need a
    logical abstraction of multiple tables, consider EJB2.0 relations or a product
    like toplink for your object to relational mapping.
    Viresh Garg
    Principal Developer Relations Engineer
    BEA Systems
    Rein Reezigt wrote:
    Hello,
    I was wondering if it is possible to persist an Entity Bean over more than
    one table using CMP. For example 3 attributes go in table A and 2 attributes
    go in table B.
    I can see this might come in handy when having some kind of inheritance in
    your architecture.
    Thanks,
    Rein Reezigt

  • How do u save datas more than one table using net beans ide using JSF

    Hi,
    I am new to JSF.
    I save / delete / update / New master table using POJO (Plain Old Java Objects), database - oracle and Toplink Persistence Unit.
    How do u save data more than one table using net beans ide using JSF (I am using POJO) ?
    and also Tell me the reference book for JSF.
    Thanks in advance.
    regards,
    N.P.Siva

    SivaNellai wrote:
    I am new to JSF.
    So, I am using net beans IDE 6.1 from sun microsystem. It is a free software.No, you don't drag'n'drop if you're new to JSF. Switch to source code mode. Write code manually, with the help of IDE for the speed up.
    So, please guide me the reference books, articles. I need the basic understanding of JSF, net beans IDE.[JSF: The Complete Reference|http://www.amazon.com/JavaServer-Faces-Complete-Reference/dp/0072262400] is a good book. The [JSF specification document|http://jcp.org/aboutJava/communityprocess/final/jsr252/index.html] is also a good reading to understand what JSF is and how it works. There are also javadocs and tlddocs of Sun JSF Mojarra.

  • Layout issue - More than one table sections on report?

    Hello all
    I am wondering if any of you know if there is a way to have more than one table or table field on a report.
    I'm asking this because I'd like to include a large number of fields in one report, but then that makes the report hard to read (everything is on one long line).
    I am wondering if there is a way to have more than one table section on a report so I could have the address information at the top of the report than have other additional information below the address. Basically I'm interested in making things easier to read for the user.

    Use Pivot tables to isolate the columns you want in each table in your report.
    Mike L

  • How can i update more than one table at a time?

    i would like to update more than one table at a time. In Java Studio creator2 how can i do table updation?

    Hi,
    Please go through the below thread might be of help to you.
    http://forum.sun.com/jive/thread.jspa?forumID=123&threadID=51839
    RK

  • How to select a substring in oracle up to a more than one specific character

    How to select a substring in oracle up to a more than one specific character
    for ex : 121.051^NP: FAMILY PRACTICE  ( trim the values before ^ )
                121.051^*NP: FAMILY PRACTICE (trim the value before *).
    with below function I can only get rid of ^ , I want both the specific characters ^ and ^* to be removed at the same time.   
    SUBSTR(p.phys_sub_grp_2_desc,INSTR(p.phys_sub_grp_2_desc, '^') +1)

    Another option is to boldly replace 'em:
    SQL> with t as (
      2  select '121.051^NP: FAMILY PRACTICE' str from dual union
      3  select '121.051^*NP: FAMILY PRACTICE' from dual
      4  )
      5  --
      6  -- actuel query:
      7  --
      8  select substr( replace(str, '*')
      9               , instr(replace(str, '*'), '^')+1
    10               ) str
    11  from   t;
    STR
    NP: FAMILY PRACTICE
    NP: FAMILY PRACTICE
    2 rows selected.

Maybe you are looking for