Exits a compound statement or loop.
BREAK
The BREAK statement is a control statement that allows you to leave a loop. Execution resumes at the first statement after the loop.
None.
None.
SQL/2008 Transact-SQL extension.
In this example, the BREAK statement breaks the WHILE loop if the most expensive product has a price above $50. Otherwise, the loop continues until the average price is greater than or equal to $30:
WHILE ( SELECT AVG( UnitPrice ) FROM Products ) < $30 BEGIN UPDATE Products SET UnitPrice = UnitPrice + 2 IF ( SELECT MAX(UnitPrice) FROM Products ) > $50 BREAK END |
![]() |
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |