====== pears.PadStr ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
create function "pears"."PadStr"(
/* Application Maintained Function / Procedure - DO NOT EDIT*/
in "TheStr" char(50),in "TargetLength" tinyint,in "PadChar" char(1) )
returns char(50)
begin
declare "rv" char(50);
set "rv" = "left"("isnull"("thestr",''),"targetlength");
if "isnull"("PadChar",'') = '' then
set "PadChar" = ' '
end if;
while "length"("rv") < "targetlength" loop
set "rv" = "rv"+"padchar"
end loop;
return "rv"
end