====== pears.GetLinkedCompanyList ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== create procedure "pears"."GetLinkedCompanyList"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "ParentCompID" char(20),inout "CurrentList" long varchar,inout "lc" integer ) begin -- terminating condition if not exists(select "companyid" from "company" where "parentcompanyid" = "ParentCompID") then return end if; if "lc" > 1000 then return end if; -- recursive calls in cursor for "companies" as "compcursor" no scroll cursor for select "companyid" as "cid" from "company" where "parentcompanyid" = "ParentCompID" for read only do set "lc" = "lc"+1; if "CurrentList" is not null then set "CurrentList" = "CurrentList"+',' end if; set "CurrentList" = "CurrentList"+''''+"cid"+''''; call "GetLinkedCompanyList"("cid","CurrentList","lc") end for end go COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."GetLinkedCompanyList" IS {create procedure GetLinkedCompanyList /* Application Maintained Function / Procedure - DO NOT EDIT*/ (in ParentCompID char(20),inout CurrentList long varchar,inout lc integer) begin -- terminating condition if not exists(select companyid from company where parentcompanyid = ParentCompID) then return end if; if lc > 1000 then return end if; -- recursive calls in cursor for companies as compcursor no scroll cursor for select companyid as cid from company where parentcompanyid = ParentCompID for read only do set lc=lc+1; if CurrentList is not null then set CurrentList=CurrentList+',' end if; set CurrentList=CurrentList+''''+cid+''''; call GetLinkedCompanyList(cid,CurrentList,lc) end for end }