diff --git a/copy_map.sql b/copy_map.sql
new file mode 100644
index 0000000000000000000000000000000000000000..c0f4c40a3e928f8048d726d69c3f1bafb00883f9
--- /dev/null
+++ b/copy_map.sql
@@ -0,0 +1,34 @@
+CREATE OR REPLACE FUNCTION public.copy_map(withukd integer, withoutukd integer)
+ RETURNS integer
+ LANGUAGE plpgsql
+AS $function$ 
+	--declare maxrate1 int default -1; maxrate2 int default -1; examtype1 exam_credit_grading_credit default null; examtype2 exam_credit_grading_credit default null;
+	declare newid int default -1; keyid int default -1; 
+	crsModules cursor for select modules.id, modules."name", modules.ordernum, modules."type" 
+							from modules 
+							where modules.disciplineid=withukd and modules.ordernum!=3141592 and modules.ordernum!=2900666; -- exam and extra
+	crsSubmodules cursor for select submodules.maxrate, submodules.ordernum, submodules."name", submodules.description, submodules.isused, submodules."type" 
+								from submodules 
+								where submodules.moduleid=keyid;
+	
+begin
+/*    select maxrate, examtype into maxrate1, examtype1 
+    from disciplines where id=withukd;
+    select maxrate, examtype into maxrate2, examtype2 
+    from disciplines where id=withoutukd;
+*/    
+	--if (maxrate1=100 and maxrate2!=100 and examtype1=examtype2 and examtype1 is not null) then
+		for mdl in crsModules loop
+		    keyid=mdl.id;
+			insert into modules("name", ordernum, disciplineid, "type") 
+						 values(mdl."name", mdl.ordernum, withoutukd, mdl."type") returning id into newid;		 
+			for sbmdl in crsSubmodules loop
+				insert into submodules(moduleid, maxrate, ordernum, "name", description, isused, "type") 
+								values(newid, sbmdl.maxrate, sbmdl.ordernum, sbmdl."name", sbmdl.description, sbmdl.isused, sbmdl."type");
+			end loop;
+		end loop;	
+		return 0;
+	--end if;
+	return -1;
+end
+ $function$;