Index: openacs-4/packages/new-portal/sql/oracle/api-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/new-portal/sql/oracle/api-create.sql,v
diff -u -r1.30 -r1.31
--- openacs-4/packages/new-portal/sql/oracle/api-create.sql	21 Jan 2002 22:08:19 -0000	1.30
+++ openacs-4/packages/new-portal/sql/oracle/api-create.sql	22 Jan 2002 20:02:39 -0000	1.31
@@ -179,8 +179,13 @@
 		);
 
                 if template_id is null then	       
-                   select max(theme_id) into v_theme_id from portal_element_themes;
 
+                   if portal.new.theme_id is null then
+                      select max(theme_id) into v_theme_id from portal_element_themes;
+                   else 
+                        v_theme_id := portal.new.theme_id;
+                   end if;
+                   
                    if layout_id is null then
                      select min(layout_id) into v_layout_id from portal_layouts;
                    else 
