database:functions:pears_getcompanyphoneinblock



pears.GetCompanyPhoneInBlock

Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.

CREATE FUNCTION "pears"."GetCompanyPhoneInBlock"( 
  /* Application Maintained Function / Procedure - DO NOT EDIT*/
  IN "reqcompanyid" CHAR(20) ) 
RETURNS long VARCHAR
BEGIN
  DECLARE "phones" long VARCHAR;
  DECLARE "newline" CHAR(2);
  DECLARE "loopcounter" tinyint;
  DECLARE "tab" CHAR(1);
  DECLARE "TabString" CHAR(2);
  SET "newline" = "char"(13)+"char"(10);
  SET "phones" = '';
  SET "loopcounter" = 0;
  SET "tab" = "char"(9);
  FOR "fetchfor" AS "fetchcursor" no scroll cursor FOR
    SELECT "phonetype"."name" AS "nextname","phone"."number" AS "nextnumber" FROM "phone"
        KEY JOIN "phonetype" WHERE "phone"."who" = 'C' AND "whoid" = "reqcompanyid"
      ORDER BY "phone"."whoid" ASC,"phonetype"."sortorder" ASC,"phonetype"."name" ASC FOR READ ONLY do
    IF "loopcounter" > 0 THEN
      SET "phones" = "phones" || "newline"
    END IF;
    IF "length"("nextname") < 8 THEN SET "TabString" = "Tab"+"Tab"
    ELSE SET "TabString" = "Tab"
    END IF;
    SET "phones" = "phones" || "nextname" || "TabString" || "nextnumber";
    SET "loopcounter" = "loopcounter"+1 END FOR;
  RETURN "phones"
END
  • database/functions/pears_getcompanyphoneinblock.txt
  • Last modified: 2026/08/07 19:24
  • by 127.0.0.1