先要有索引:D1,D2,B2 都要有。
1、在A表中取出符合条件的(条件先忽略)且A.D1离现在时间最近的记录(如果D1中所有的时间都小于当前时间则可以取最大值)
 select * from a where d1 = (select min(abs(sysdate - d1)) from a where ..) and ..或
 select * from a where d1 = (select max(d1) from a where ..) and ..
2、然后在B表中取出符合条件的OBJDATE离现在时间最近的记录,其中OBJDATE的形成条件是:
若B.B2>'15' 取出B.D1作为OBJDATE
若B.B2<='15' 取出B.D2作为OBJDATE
 select * from b where decode(sign(b2 - 15),1,D1,D2) = (select min(abs(sysdate - decode(sign(b2 - 15),1,D1,D2))) from b where ..) and ..或
 select * from b where decode(sign(b2 - 15),1,D1,D2) = (select max(decode(sign(b2 - 15),1,D1,D2)) from b where ..) and ..