Connecting Tech Pros Worldwide Forums | Help | Site Map

Convert Oracle outer join query to PostgreSql

Newbie
 
Join Date: Sep 2008
Posts: 2
#1: Oct 28 '08
Hello all.. I am trying to convert an application which is working on Oracle to postgreSql..
I've seen a query in code something like this...

Expand|Select|Wrap|Line Numbers
  1. select  *
  2. from    table1 a1 , table1 a2, table2 a3,        
  3. where   a1.childid = a2.parentid(+)
  4. and     a2.childtype (+)= 'Something'
  5. and     a2.parenttype (+)= 'Something'
  6. and     a2.childid = a3.id (+)
It's been used oracle iso99 style (+) outer join as you see..

But..I've searched google, other forums.. But i can't convert this query to postgreSql..(my mind is stopped)
Postgre wants me to use LEFT JOIN RIGHT JOIN, and wants me to use this after the FROM word..
So.. I am confused. Have you got any idea for this query?

Thanks in advance..

Lives Here
 
Join Date: Sep 2006
Posts: 12,070
#2: Oct 31 '08

re: Convert Oracle outer join query to PostgreSql


Try
Expand|Select|Wrap|Line Numbers
  1. select  *
  2.  from table1 a2  
  3.       left join table1 a1 on (a1.childid = a2.parentid)
  4.        right join table2 a3 on (a2.childid = a3.id) 
  5.        where ( a2.childtype = 'Something' or a2.childtype is null)
  6.        and ( a2.parenttype = 'Something' or a2.parenttype is null)
Reply