INSERT INTO YCRN (YCRN_ID,YCRN_YRES_ID,YCRN_CRSSYSTEM,YCRN_CRSRESNR) SELECT SEQ_YCRN.NEXTVAL,YRES_ID,YRES_CRSSYSTEM,YRES_CRSRESNR FROM YRES WHERE YRES_CRSSYSTEM IS NOT NULL AND NOT EXISTS (SELECT 1 FROM YCRN WHERE YCRN_CRSSYSTEM=YRES_CRSSYSTEM AND YCRN_YRES_ID=YRES_ID);

BEGIN V8_UPD_CRSNumberRights; COMMIT; END;
/
