====== pears.getline ====== Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. ===== Original SQL ===== create function "pears"."getline"( /* Application Maintained Function / Procedure - DO NOT EDIT*/ in "s1" long varchar,in "ln1" smallint ) returns long varchar begin declare "i" smallint; declare "ln" smallint; declare "s" long varchar; set "ln" = "ln1"; set "s" = "s1"; "loop1": loop set "ln" = "ln"-1; if "ln" <= 0 then leave "loop1" end if; set "i" = "charindex"("char"(13),"s"); if "i" > 0 and "length"("s") > "i"+1 then set "s" = "stuff"("s",1,"i"+1,'') else set "s" = '' end if end loop "loop1"; set "i" = "charindex"("char"(13),"s"); if "i" > 0 then set "s" = "left"("s","i"-1) end if; return("s") end