====== pears.proper ======
Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
===== Original SQL =====
COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."proper" IS
{create function proper
/* Application Maintained Function / Procedure - DO NOT EDIT*/
(in OldString char(255))
returns char(255)
begin
declare NewString char(255);
declare StringLength smallint;
declare CurrentChar char(1);
declare LastChar char(1);
declare CurrentPos smallint;
if OldString is null then return(null)
end if;
set oldstring=lower(oldstring);
set stringlength=length(OldString);
set CurrentPos=1;
set NewString='';
process: loop
set CurrentChar=substr(OldString,CurrentPos,1);
if CurrentPos = 1 then
set currentchar=upper(currentchar)
else
set LastChar=substr(OldString,CurrentPos-1,1);
if ascii(lower(lastchar)) not between 97 and 122 and(ascii(lastchar) not between 128 and 154) and(ascii(lastchar) not between 160 and 165) then
set CurrentChar=upper(CurrentChar)
end if
end if;
set NEWString=Newstring || CurrentChar;
set CurrentPos=CurrentPos+1;
if CurrentPos > StringLength then leave process
end if
end loop process;
return(NewString)
end
}