oracle8.1.6 begin content_template.delete(:template_id); end; select 't' from dual where not exists ( select 1 from cr_templates t, acs_objects o where o.object_id = t.template_id and o.context_id = :template_id and not exists (select 1 from cr_revisions where revision_id = t.template_id))