string(510) " FROM tabarquivos A LEFT JOIN tabcompetencia cp on (A.NComp = cp.IdComp), tabtipoarq T, tabcatarq C WHERE ((A.NTipoArq = T.IdTipoArq) or (A.NTipoArq IS NULL) ) AND ((T.NTipoCat = C.Id) or (T.NTipoCat IS NULL)) AND A.DtDelete IS NULL AND A.NCaracteristica = :car AND NTipoArq IN (SELECT IdTipoArq FROM TabTipoArq WHERE IdTipoArq > 0 AND NCaracteristica = '24' )"