|  |  Login Products  Sales  Support  Downloads  About | 
| Home » Technical Support » ElevateDB Technical Support » Product Manuals » ElevateDB Version 2 SQL Manual » SQL/PSM Statements » REPEAT | 
 REPEAT
 REPEAT[Label:] REPEAT <StatementBlock> UNTIL <BooleanExpression> END REPEAT [Label]; <StatementBlock> = <StatementBlock> = [[Label:] BEGIN] [<Statement>;] [<Statement>;] [EXCEPTION] [<Statement>;] [END [Label];]
-- This function simply repeats a
-- a string the specified number of times
-- and returns the resultant string
CREATE FUNCTION RepeatString(IN "StringToRepeat" VARCHAR, IN "RepeatCount" INTEGER)
RETURNS VARCHAR
BEGIN
   DECLARE I INTEGER DEFAULT 1;
   DECLARE Result VARCHAR DEFAULT '';
   IF RepeatCount = 0 THEN
      LEAVE;
   END IF;
   
   REPEAT
      SET Result = (Result + StringToRepeat);
      SET I = (I + 1);
   UNTIL (I > RepeatCount) END REPEAT;
   RETURN Result;
END| Deviation | Details | 
| None | 
 More Support Options
 More Support Options| This web page was last updated on Tuesday, September 16, 2025 at 04:56 PM | Privacy Policy  Site Map © 2025 Elevate Software, Inc. All Rights Reserved Questions or comments ?  E-mail us at info@elevatesoft.com | 
