Question : a table may be outer joined to at most one other table ORACLE 11G

I WOULD LIKE TO BRING PEOPLE BACK FROM THE  personnel_vw EVEN THOUGH THEY DO NOT EXISTS IN CHK_PER_PROGRAMS_VW. How should I construct the following query?


select distinct
      p.name
      mtlav.title
      itla.status,
      mdmacty.category
      p.labor_category
      p.department
      itltl.id
      itltl.percent_complete,
     
   from
      accreditations itla,
      tasklists itltl,
      mtl_accred_versions mtlav,
      mdm_accred_types mdmacty,
      personnel_vw  p,
      chk_accred_programs_vw capvw,
      chk_per_programs_vw  cpp
   where
      mtlav.mtl_accred_version_id         = itla.mtl_accred_version_id
      and mtlav.mdm_accred_type_id        = mdmacty.mdm_accred_type_id
      and itla.per_person_id              = p.person_id
      and itla.itl_accreditation_id       = itltl.itl_accreditation_id(+)
      and itla.per_person_id              = itltl.per_person_id(+)
      and mtlav.mtl_accreditation_id      = capvw.mtl_accreditation_id(+)
      and  capvw.mtl_program_id           = cpp.mtl_program_id(+)
      and  p.person_id                    = cpp.per_person_id(+)  I WOULD LIKE TO BRING PEOPLE BACK P.PERSON_ID EVEN THOUGH IT DOES NOT EXIST IN CHK_PER_PROGRAMS_VW. I can I construct THEjoin to prevent this error?
     

Answer : a table may be outer joined to at most one other table ORACLE 11G

Hi,

You should switch from the old style Oracle syntax, i.e. using (+) in where clause, to ANSI standard syntax, i.e. use LEFT OUTER JOIN.  The ANSI syntax allows overcomes the limitation.

e.g.
select distinct
       p.name
       mtlav.title
       itla.status,
       mdmacty.category
       p.labor_category
       p.department
       itltl.id
       itltl.percent_complete    
  from accreditations itla
  LEFT JOIN tasklists itltl ON itla.itl_accreditation_id = itltl.itl_accreditation_id and itla.per_person_id              = itltl.per_person_id
       JOIN mtl_accred_versions mtlav ON mtlav.mtl_accred_version_id = itla.mtl_accred_version_id
       JOIN mdm_accred_types mdmacty ON mtlav.mdm_accred_type_id = mdmacty.mdm_accred_type_id
       JOIN personnel_vw  p ON itla.per_person_id = p.person_id
  LEFT JOIN chk_accred_programs_vw capvw on mtlav.mtl_accreditation_id = capvw.mtl_accreditation_id
  LEFT JOIN chk_per_programs_vw cpp ON capvw.mtl_program_id = cpp.mtl_program_id and  p.person_id = cpp.per_person_id
Random Solutions  
 
programming4us programming4us