These two while loops
while select table1 where table1.AId == _aId && table1.OC == OC::B && table1.ORC == _bId { LanguageTxt::createOrUpdate(table1.TableId, table1.RecId, _description, _languageId); } while select table1 where table1.AId == _aId && table1.OC == OC::DR exists join table2 where table2.OId == table1.OId exists join table3 where table3.DId == table2.DId && table3.BId == _bId{ LanguageTxt::createOrUpdate(table1.TableId, table1.RecId, _description, _languageId);}
OR (combining them)
while select table1 where table1.AId == _aId outer join RecId from table2 where table2.OId == table1.OId outer join RecId from table3 where table3.DId == table2.DId && ( ( table1.OC == OC::DR && table3.BId == _bId ) || ( table1.OC == OC::B && table1.ORC == _bId ) ){ LanguageTxt::createOrUpdate(table1.TableId, table1.RecId, _description, _languageId);}