This PL/SQL function is easier to use:
create or replace function search_get_community_name(
v_package_id in integer)
return varchar2
is
v_instance_name apm_packages.instance_name%TYPE;
begin
select instance_name
into v_instance_name
from apm_packages apm, (select object_id
from site_nodes
connect by prior parent_id = node_id start with object_id = v_package_id) sn
where apm.package_id = sn.object_id
and apm.package_key = 'dotlrn'
and rownum=1;
return v_instance_name;
end;
/
show errors