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.16 -r1.17
--- openacs-4/packages/new-portal/sql/oracle/api-create.sql	14 Nov 2001 20:21:36 -0000	1.16
+++ openacs-4/packages/new-portal/sql/oracle/api-create.sql	14 Nov 2001 22:02:40 -0000	1.17
@@ -46,6 +46,7 @@
 	) return portals.portal_id%TYPE
 	is
 		v_portal_id portals.portal_id%TYPE;
+		v_theme_id portals.theme_id%TYPE;
 	begin
 		v_portal_id := acs_object.new (
 			object_id	=> portal_id,
@@ -56,13 +57,16 @@
 			context_id	=> context_id
 		);
 
+
+		select max(theme_id) into v_theme_id from portal_element_themes;
+
 		insert into portals (portal_id, layout_id, name, theme_id) 
 		       values (v_portal_id, 
 			       layout_id, 
 			       'Untitled', 
-			       nvl((select max(theme_id) from portal_element_themes), 1) 
+			       v_theme_id
 			       );
-`
+
 		return v_portal_id;
 	end new;
 
