22,209
社区成员
发帖
与我相关
我的任务
分享
CREATE PROCEDURE nested_blocks5( )
outer_block: BEGIN
DECLARE l_status int;
SET l_status=1;
inner_block: BEGIN
IF (l_status=1) THEN
LEAVE inner_block;
END IF;
SELECT 'This statement will never be executed';
END inner_block;
SELECT 'End of program';
END outer_block
MS-SQL 中有
--while,continue,break用法
declare @i int
set @i=1
while @i<20
begin
set @i=@i+1
if @i<=19
continue
print @i
end
declare @i int
set @i=1
while @i<20
begin
if @i=19
break
print @i
set @i=@i+1
end