Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace.
CREATE FUNCTION "pears"."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