string(441) " 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.NCaracteristica = :car AND NTipoArq IN (SELECT IdTipoArq FROM TabTipoArq WHERE IdTipoArq > 0)"