DECLARE nSeq int; BEGIN EXECUTE 'select nextval(''seqVisitaCMPD_Aud'');' INTO nSeq; new.id:= nSeq; return new;END