oracle8.1.6
select
case when m.element_id = e.element_id then 1 else 0 end as local_p,
decode(acs_permission.permission_p(:element_id, :user_id, 'delete'), 't', 1, 'f', 0) as element_delete_p
from portal_available_element_map m, portal_elements e
where
m.element_id = e.element_id and
m.element_id = :element_id and
m.portal_id = :default_portal_id
begin
portal_element.delete(:element_id);
end;