select count(*) from dual where exists (select 1 from dotlrn_applets where dotlrn_applets.applet_key = :applet_key) select applet_id from dotlrn_applets where applet_key = :applet_key insert into dotlrn_applets (applet_id, applet_key, package_key, active_p) values (:applet_id, :applet_key, :package_key, :active_p) select applet_key from dotlrn_applets select package_key from dotlrn_applets where applet_key = :applet_key delete from dotlrn_community_applets where applet_id in (select applet_id from dotlrn_applets where applet_key = :applet_key) delete from dotlrn_applets where applet_key = :applet_key