Declare
   ver_id number;
   pjt_name nx_delimiters.project_name%TYPE;
   mdl_name nx_delimiters.module_name%TYPE;
   lang nx_delimiters.language_code%TYPE;
   ver_num nx_delimiters.version_number%TYPE;
   b_del nx_delimiters.begin_delimiter%TYPE;
   e_del nx_delimiters.end_delimiter%TYPE;
   del_type nx_delimiters.delimiter_type%TYPE;
   cursor delimiter_cursor is
       select project_name, language_code, module_name, version_number,
              begin_delimiter, end_delimiter, delimiter_type
          from nx_delimiters;

Begin
   open delimiter_cursor;
   Loop
      FETCH delimiter_cursor into pjt_name, lang, mdl_name, ver_num,
                                  b_del, e_del, del_type;
      EXIT WHEN delimiter_cursor%NOTFOUND;

      select nv.version_id into ver_id from nx_version nv, nx_project np,
             nx_module nm
      where np.name = pjt_name
      and   nm.name = mdl_name
      and   np.project_id = nm.project_id
      and   nv.project_id = np.project_id
      and   nv.version_number = ver_num
      and   nv.module_id = nm.module_id;
      Insert into nx_delimiter values (del_type, b_del, e_del, ver_id);
   End Loop;
   CLOSE delimiter_cursor;
   COMMIT;
End;
/
