DBAsupport.com Forums - Powered by vBulletin
Results 1 to 7 of 7

Thread: INNER and OUTER JOIN

  1. #1
    Join Date
    Aug 2001
    Posts
    12
    Hello Friends,

    I've recently bumped into a problem when porting a small application from SQL Server to Oracle. The application uses quite a number of sql statements with INNER and OUTER JOIN syntax. While pure INNER JOINS are easy to rewrite by specifing the JOIN condition in WHERE clause, how to deal with OUTER JOINS?

    For example: sql statement

    SELECT * FROM A LEFT OUTER JOIN B ON A.ID = B.ID

    How to implement it in Oracle? Also, I connect to Oracle using Oracle ODBC Driver - shouldn't it support ANSI SQL syntax? Why doesn't it recognize INNER and OUTER JOINS?

    Thank you for your replies!

  2. #2
    Join Date
    Jan 2001
    Posts
    2,828

    Talking

    Hello

    Oracle does support outer joins you can sue somethin similar to this

    SELECT * FROM A
    Where A.ID = B.ID(+);

    note the (+) is the outer join operator

    regards
    hrishy



  3. #3
    Join Date
    Aug 2001
    Posts
    12
    Hi,
    So basically there's no way for oracle to recognize ANSI SQL syntax such as LEFT OUTER JOIN? Why doesn't Oracle ODBC driver support it?
    I thought all odbc drivers need to support ansi standard?

    My questions might sound stupid, but I'm trying to understand this problem. It seems like writing ansi compliant sql queries will not be a cure for cross-database code problem...

  4. #4
    Join Date
    Oct 2000
    Location
    Germany
    Posts
    1,185
    Only snide comments:

    Keeping the business logic on the middle tier does not guarantee that one can replace the database with a completely different brand and version if the the data models are identical.

    DB2 uses the same outer join syntax as SQL Server. In reading the first DB2 manual, I have come across numerous differences between DB2 and Oracle.

    Good luck.
    David Knight
    OCP DBA 8i, 9i, 10g

  5. #5
    Join Date
    Aug 2001
    Posts
    12
    Thanks, at least some databases follow standards...
    But what are the reasons Oracle doesn't want to support ansi... to make our life harder?

  6. #6
    Join Date
    Apr 2001
    Posts
    118
    I doubt that it will make you feel better, but Oracle is supporting the ANSI syntax in 9i. They even recommend that you use the ANSI syntax instead of the Oracle syntax (+).

    http://download-west.oracle.com/otnd...s2.htm#2054625

    Heath

  7. #7
    Join Date
    Dec 2000
    Location
    Ljubljana, Slovenia
    Posts
    4,439
    Virtually all mayor DB vendors have reached *ENTRY LEVEL* compliance with SQL92 standard, but one of them have reached a higher level than this. ENTRY level is the lowest of four levels that defines compliance with standard.

    All of them specify they are ANSI/ISO compliant, but they never tell you the whole story.... Oracle is no better than any of other DB vendors regarding this isue, but also no worse than the others. INNER/OUTER join syntax is just one of the fragments in the standard, there are *many* others where Oracle is "more compliant" than others...
    Jurij Modic
    ASCII a stupid question, get a stupid ANSI
    24 hours in a day .... 24 beer in a case .... coincidence?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width