Crear vista de NPPARTIDAS
De CidesaWiki
create or replace view nppartidas as (select substr(a.codpre,b.longitud) as codpar,max(nompre) as nompar from cpdeftit a, (select sum(lonniv+1)+1 as longitud from cpniveles where catpar='C') b, (select sum(lonniv+1)-1 as longtot from cpniveles) c where length(rtrim(a.codpre))=c.longtot group by substr(a.codpre,b.longitud))
--Pablosilva 14:58 27 nov 2008 (VET)