postgresql7.1
select case when exists (
select 1
from application_group_element_map
where package_id = :package_id
and element_id = :party_id
union all
select 1
from application_groups
where package_id = :package_id
and group_id = :party_id
) then 1 else 0 end
select case when exists (
select 1
from application_group_element_map
where package_id = :package_id
and element_id = :party_id
union all
select 1
from application_groups
where package_id = :package_id
and group_id = :party_id
) then 1 else 0 end
select case when exists (
select 1
from application_group_element_map
where package_id = :package_id
and rel_id = :rel_id
) then 1 else 0 end
select case when exists (
select 1
from application_group_segments
where package_id = :package_id
and segment_id = :segment_id
) then 1 else 0 end
select application_group__group_id_from_package_id (
:package_id,
:no_complain_p
)
select application_group__new (
:group_id,
:group_type,
now(),
:creation_user,
:creation_ip,
:email,
:url,
:group_name,
:package_id,
null,
:package_id
)
select application_group__delete (
:group_id
)