Show pageOld revisionsBacklinksExport to PDFFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pears.GetLinkedCompanyList ====== <WRAP center round info> Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. </WRAP> ===== Original SQL ===== <code 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 } </code> database/procedures/pears_getlinkedcompanylist.txt Last modified: 2026/08/07 19:24by 127.0.0.1