pears.Base34
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"."Base34" IS {CREATE FUNCTION Base34 /* Application Maintained Function / Procedure - DO NOT EDIT*/ (IN seed INTEGER,IN digits SMALLINT) RETURNS CHAR(20) BEGIN DECLARE rv CHAR(20); DECLARE m INTEGER; DECLARE sdigits CHAR(34); -- Where the code must be handled by humans, letters O and I can be confused with zero and one so these are left out by base34 SET sdigits='0123456789ABCDEFGHJKLMNPQRSTUVWXYZ'; SET rv=''; IF((digits > 20) OR(digits < 1)) THEN SET digits=20 END IF; while seed > 0 loop SET m=MOD(seed,34); SET rv=substr(sdigits,m+1,1) || rv; SET seed=seed/34 END loop; while LENGTH(rv) < digits loop SET rv='0' || rv END loop; RETURN(rv) END }