The while
loop does indeed have a break
clause which exits the loop, and can be placed within a conditional.
The Sybase "Transact-SQL Users Guide" (and other ASE reference documents) is a valuable resource which can be read on-line or downloaded as a PDF from the Sybase website. The documentation area is currently named "Infocenter". The document set is updated for each release.
Here is an extract from the above-mentioned guide about break
(and continue
)...
break and continue control the operation of the statements inside a while loop. break causes an exit from the while loop. Any statements that appear after the end keyword that marks the end of the loop are executed. continue causes the while loop to restart, skipping any statements after continue but inside the loop. break and continue are often activated by an if test.
The syntax for break...continue is:
while boolean expression
begin
statement
[statement]...
break
[statement]...
continue
[statement]...
end