CONTINUE statement [T-SQL]

Use this statement to restart a loop.

Syntax
CONTINUE [ statement-label ]
Remarks

The CONTINUE statement is a control statement that allows you to restart a loop. Execution continues at the first statement in the loop. When CONTINUE appears within a set of statements using the Watcom-SQL, statement-label must be specified.

When CONTINUE appears within a set of statements using the Transact-SQL, statement-label must not be used.

Permissions

None.

Side effects

None.

See also
Standards and compatibility
  • SQL/2003   Transact-SQL extension.

Example

The following fragment shows how the CONTINUE statement is used to restart a loop. This example displays the odd numbers between 1 and 10.

BEGIN
   DECLARE i INT;
   SET i = 0;
   lbl:
   WHILE i < 10 LOOP
      SET i = i + 1;
      IF mod( i, 2 ) = 0 THEN 
         CONTINUE lbl
      END IF;
      MESSAGE 'The value ' || i || ' is odd.' TO CLIENT;
   END LOOP lbl;
END