====== pears.ComplianceValidPerson ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create function "pears"."ComplianceValidPerson"(
/* Application Maintained Function / Procedure - DO NOT EDIT*/
in "pPersonID" char(20),in "pIncludeWarnings" integer )
returns long varchar
begin
declare "errMsg" long varchar;
declare "warnMsg" long varchar;
for "PFOR" as "PCUR" no scroll cursor for
select "Description","Status","Info"
from "ComplianceTable"("pPersonID") for read only do
case "status"
when 1 then set "errMsg" = "string"("errMsg","Description",' ',"Info",'. ')
when 2 then set "warnMsg" = "string"("warnMsg","Description",' ',"Info",'. ')
end case
end for;
if "pIncludeWarnings" = 0 then
set "warnMsg" = null
end if;
if "warnMsg" is not null then
set "warnMsg" = "string"('Warning: ',"warnMsg")
end if;
return "nullif"("string"("errMsg","warnMsg"),'')
end