select count(*) as nb_sql_lines from (select pdt_id, round(cmp_quantite * pdt_cuvub1, 3) cmp_qte_uv, nvl(pdt_eco_reference, pdt_reference) pdt_reference, nvl(pdt_eco_designation, pdt_designation) pdt_designation, pdt_uv1, case when pdt_etat_id IN ('G', 'N', 'D', 'R') and (select count(*) from pdt_cat_produit where pdt_id = clp_pdt_id) > 0 then 1 else 0 end pdt_in_cat from pdt_composant, pdt_produit where cmp_pdt_id_ens = '228630' and pdt_id = cmp_pdt_id_cmp ) where rownum <= 1001