sql - How to Jump back to the loop increment stage inside a stored procedure if a condition is satisfied inside the loop? -


i have stored procedure shown below has loop running inside it. if condition mentioned below satisfied need go loop , start loop stage. how can achieve this?

..... steps......... while (@iv<= @rcnt) begin create table #mathlogictable  ( idnum integer identity(1,1), attributename varchar(256), inputvalues decimal(15,3) )  insert #mathlogictable       select  statements..................  if (not exists (select 1 #mathlogictable)) begin set @iv=@iv+1 (i need step go start of loop...if condition satisfies) end ------------------------------------------------------------ select............ update........ n steps......... ------------------------------------------------------------- end   

you should use continue keyword:

if (not exists (select 1 #mathlogictable)) begin     set @iv=@iv+1      continue end 

Comments

Popular posts from this blog

java - unable show chart in xls document using jasper reports -

java.lang.RuntimeException: Could not generate dummy secret at sun.security.ssl.RSAClientKeyExchange.<init> -

javascript - How to change image src on success AJAX -