sql - ORA-01799: a column may not be outer-joined to a subquery -
hi people please find code below running in db2 fails in oracle.
select * (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 not null e.branch else case when g.branch not null g.branch else i.branch end end branch (select c.time_stamp, b.applicationid, b.processname, b.stage, b.branch, b.initiatingsource, case when d.status null c.status else d.status end status, c.time_stamp start_time, case when d.time_stamp not null d.time_stamp else current_timestamp ens end_time (select distinct f.applicationid, f.branch, f.initiatingsource, f.processname, case when f.stage in ('start''end') 'application' else f.stage, f.stagecounter processmetric f) b left join processmetric c on b.applicationid = c.applicationid , b.processname = c.processname , (b.stage = c.stage or (b.stage = 'application' , c.stage = 'start')) , b.stagecounter = c.stagecounter , c.phase = 'start' left join processmetric d on b.applicationid = d.applicationid , b.processname = d.processname , (b.stage = d.stage or (b.stage = 'application' , d.stage = 'end')) , b.stagecounter = d.stagecounter , d.phase ='end')e left join applicationcustomerdata g on g.applicationid = e.applicationid , g.time_stamp in (select max(x.time_stamp) applicationcustomerdata x x.applicationid = g.applicationid ) left join applicationdata on i.applicationid = e.applicationid , i.time_stamp in (select max(z.time_stamp) applicationdata z z.applicationid = i.applicationid ) order e.start_time ) a.start_time not null , a.stage not in ('application') , a.status not in ('complete' , 'completed' , 'cancel', 'fraud' , 'decline') , a.stage = 'verification';
oracle don't allow make outer join subquery. following 2 joins problematic ones:
left join applicationcustomerdata g on g.applicationid = e.applicationid , g.time_stamp in (select max(x.time_stamp) applicationcustomerdata x x.applicationid = g.applicationid ) left join applicationdata on i.applicationid = e.applicationid , i.time_stamp in (select max(z.time_stamp) applicationdata z z.applicationid = i.applicationid ) you need rewrite statement (if need in 1 sql) or write pl/sql loops through data.
Comments
Post a Comment