Navigation:  NexusDB Guide > SQL Reference > SQL Statements > Control Statements >

REPEAT statement

Previous pageReturn to chapter overviewNext page

NexusDB V3 Manual

REPEAT statement

button_main button_prev button_next

NexusDB Manual V3 > SQL Reference > SQL Statements > Control Statements

Repeat the execution until the condition is true.

 

Syntax

 

<repeat statement> ::=

 

 

 

REPEAT

<SQL statement list>

UNTIL <search condition>

END REPEAT

 

Usage

 

The REPEAT statement is used to specify a repeated iteration of the statement block until the search condition is true.

 

See also: WHILE statement

 

 

Examples

 

1)

The following example shows the REPEAT statement used in SQL code:

 

      DROP FUNCTION IF EXISTS dummyFunc;

      CREATE FUNCTION dummyFunc( p1 INTEGER )

      RETURNS INTEGER

      BEGIN

DECLARE v1, v2 INTEGER;

SET v1 = p1;

SET v2 = p1 * 10;

REPEAT

SET v1 = v1 + p1;

UNTIL v1 = v2

END REPEAT;

RETURN v1;

      END;

      SELECT dummyFunc( 10 ) FROM #dummy;

 

 


Conformance

 

SQL:2003 standard

-

-

SQL/PSM Feature P002-11 "REPEAT statement"

Beginning and ending statement labels are not supported

 

© Nexus Database Systems Pty Ltd.

nexus_logo