Results 1 to 4 of 4

Thread: Oracle vs Sql Server (LEFT OUTER JOIN)

  1. #1

    Thread Starter
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228

    Unhappy Oracle vs Sql Server (LEFT OUTER JOIN)

    Hi All,
    I am facing a problem with Oracle / Sql Server owing to the way they treat left outer joins.
    Here is an example.
    [CODE]
    For SQL Server
    CREATE TABLE LEFTTAB(A VARCHAR(1), B VARCHAR(10), C varchar(10))

    CREATE TABLE RIGHTTAB(A VARCHAR(1), B VARCHAR(10), C varchar(10))

    insert into lefTtab values('A','Example','Sample')

    select A.A, B.A from lefttab A left outer join righttab B
    ON A.A = B.A AND A.C = B.C AND A.B = B.B AND b.b = 'IND'
    'The select query will always return a row whether table b contains any rows or not.
    [CODE]

    Code:
    'For Oracle
    CREATE TABLE LEFTTAB(A VARCHAR2(1), B VARCHAR2(10), C varchar2(10))
    
    CREATE TABLE RIGHTTAB(A VARCHAR2(1), B VARCHAR2(10), C varchar2(10))
    
    insert into lefTtab values('A','Example','Sample')
    
    select A.A, B.A from lefttab A, righttab B 
    	WHERE A.A = B.A(+) AND A.C = B.C(+) AND A.B = B.B(+) AND b.b = 'IND'
    'will not a return any rows unless I drop out the condition b.b = 'IND'
    If I change the query to this
    
    select A.A, B.A from lefttab A, righttab B 
    	WHERE A.A = B.A(+) AND A.C = B.C(+) AND A.B = B.B(+) OR b.b = 'IND'
    
    I get the following error message
    
    ERROR at line 2:
    ORA-01719: outer join operator (+) not allowed in operand of OR or IN
    What should I do?

    Perplexingly,
    Abhijit
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

  2. #2
    Fanatic Member
    Join Date
    Aug 2001
    Location
    Connecticut
    Posts
    855
    For sql server, the criteria should use a Where clause to return no rows:
    select A.A, B.A from lefttab A left outer join righttab B
    ON A.A = B.A AND A.C = B.C AND A.B = B.B WHERE b.b = 'IND'
    VB 6.0, Access, Sql server, Asp

  3. #3
    Hyperactive Member csar's Avatar
    Join Date
    Mar 2002
    Location
    Siam
    Posts
    288
    LEFT, RIGHT ,OUTTER JOIN is exist for 9i
    Don't leave it till tomorrow, Do It Now!
    5361726176757468204368616E63686F747361746869656E

  4. #4

    Thread Starter
    PowerPoster abhijit's Avatar
    Join Date
    Jun 1999
    Location
    Chit Chat Forum.
    Posts
    3,228
    Haven't got 9i yet. SO have to work on Oracle 8i. My problem is that I need to have the query return the same results in Oracle as well as SQL Server, cos the application is supposed to support both the databases adn I am porting it to Oracle.

    Any ideas,
    Abhijit
    Everything that has a computer in will fail. Everything in your life, from a watch to a car to, you know, a radio, to an iPhone, it will fail if it has a computer in it. They should kill the people who made those things.- 'Woz'
    save a blobFileStreamDataTable To Text Filemy blog

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