title: ORA-01799: a column may not be outer-joined to a subquery
body: <p>hi good people please find the code below is running in db2 but fails in oracle.</p>
  
  <pre><code>select  * from
       (select distinct e.time_stamp,e.applicationid, e.processname,
       e.stage, e.initiatingsource, e.status, e.start_time, i.consultant, 
       g.cifnumber, g.applicantfirstname, g.applicantlastname, 
       case when e.branch is not null 
       then e.branch 
       else case when g.branch is not null 
            then g.branch 
            else i.branch 
            end 
       end as branch 
  from (select c.time_stamp, b.applicationid, b.processname, 
          b.stage, b.branch, b.initiatingsource, 
          case when d.status is null 
          then c.status 
          else d.status 
          end as status, 
          c.time_stamp as START_TIME, 
          case when d.time_stamp is not null 
          then d.time_stamp 
          else current_timestamp 
          ens as END_TIME 
       from (select distinct f.applicationid, f.branch, f.initiatingsource, f.processname, 
               case when f.stage in ('START''END') 
               then 'APPLICATION' 
               else f.stage, f.stagecounter 
             from processmetric f) b 
            left join processmetric c on b.applicationid = c.applicationid and b.processname = c.processname and (b.stage = c.stage or (b.stage = 'APPLICATION' and c.stage = 'START')) and b.stagecounter = c.stagecounter and c.phase = 'START' 
            left join processmetric d on b.applicationid = d.applicationid and b.processname = d.processname and (b.stage = d.stage or (b.stage = 'APPLICATION' and d.stage = 'END')) and b.stagecounter = d.stagecounter and d.phase ='END')e 
  left join applicationcustomerdata g on g.applicationid = e.applicationid 
     and g.time_stamp in (select max(x.time_stamp) 
                          from applicationcustomerdata x 
                          where x.applicationid = g.applicationid
                          ) 
  left join applicationdata i on i.applicationid = e.applicationid 
         and i.time_stamp in (select max(z.time_stamp) 
                              from applicationdata z 
                              where z.applicationid = i.applicationid
                             )
  order by e.start_time
  ) a 
  where a.start_time is not null and a.stage not in ('APPLICATION') and a.status not in ('COMPLETE' , 'COMPLETED' , 'CANCEL', 'FRAUD' , 'DECLINE') and a.stage = 'VERIFICATION';
  </code></pre>