====== pears.GetCompanyGroup ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."GetCompanyGroup" IS
{create function GetCompanyGroup
/* Application Maintained Function / Procedure - DO NOT EDIT*/
(in coid char(20))
returns long varchar
begin
declare res long varchar;
declare pid char(20);
declare I integer;
set I=1;
select GetCompanyMainParent(coid) into pid;
if pid is not null then
set res=''''+pid+''''
else set res=''''+coid+''''
end if;
if pid is not null then
call GetLinkedCompanyList(pid,res,I)
else call GetLinkedCompanyList(coid,res,I)
end if;
return res
exception
when others then
return '''error'''
end
}