Query select distinct source_name,obj_type_name,display,attr_name,is_key from rep_pds a,rep_lds b,rep_obj_type c,rep_attribute d,rep_mapping e,rep_smm_map_rel f,rep_smm g where a.pds_id=b.pds_id and c.obj_type_id=b.obj_type_id and b.lds_id=d.lds_id and e.map_id=f.map_id and f.smm_id=g.smm_id and g.smm_name='complete' union all select distinct source_name,obj_type_name,display,'',0 from rep_pds a,rep_lds b,rep_obj_type c,rep_mapping d,rep_smm_map_rel e,rep_smm f where a.pds_id=b.pds_id and c.obj_type_id=b.obj_type_id and (b.lds_id=d.input_lds_id or b.lds_id=d.output_lds_id) and d.map_id=e.map_id and e.smm_id=f.smm_id and f.smm_name='complete' and not exists (select * from rep_attribute d where b.lds_id=d.lds_id), Wed Feb 10 17:19:32 2010

source_nameobj_type_namedisplayattr_nameis_key
testdb1testobjects1 ID11
testdb2testobjects2 ID21
testdb1query (null)0
testdb2query (null)0