Crear vista de NPCATPRE
De CidesaWiki
create or replace view npcatpre as (select rpad(substr(a.codpre,1,b.longitud),32,' ') as codcat,max(upper(trim(nompre))) as nomcat from cpdeftit a, (select sum(lonniv+1)-1 as longitud from cpniveles where catpar='C') b where length(rtrim(a.codpre))=b.longitud group by substr(a.codpre,1,b.longitud))
--Pablosilva 14:51 27 nov 2008 (VET)