Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
SQL Server 119
#SQLServer 88
Oracle 70
#SQL SERVER 35
BRH 31
SQL Server 2012 29
denali 23
#TSQL 19
TSQL 19
C# 15

Archive · View All
October 2011 31
November 2011 30
September 2011 30
August 2011 18
December 2011 15
July 2011 13
June 2011 8
May 2012 4
April 2012 3
January 2010 3

Day 63: PL/SQL - 11 (CONTINUE and CONTINUE-WHEN statement in Oracle 11g's Pl/SQL)

Nov 15 2011 11:13PM by Niladri Biswas   

CONTINUE statement

Introduce in Oracle 11g,this statement provides an easy way to force an immediate jump to the loop control statement

Let us see this into action by writing a simple Even..Odd number program

SQL> BEGIN
  2     FOR i IN 1 .. 10 LOOP	
  3        IF MOD(i,2) = 0 THEN
  4           CONTINUE;
  5		  DBMS_OUTPUT.PUT_LINE('Even Numbers := ' || TO_CHAR(i));
  6        END IF;
  7       DBMS_OUTPUT.PUT_LINE('Odd Numbers := ' || TO_CHAR(i));
  8     END LOOP;
  9  END;
  10  /
Odd Numbers := 1
Even Numbers := 2
Odd Numbers := 3
Even Numbers := 4
Odd Numbers := 5
Even Numbers := 6
Odd Numbers := 7
Even Numbers := 8
Odd Numbers := 9
Even Numbers := 10
PL/SQL procedure successfully completed.

In this first case, that i value is 1. So the condition

MOD(i,2) = 0
evaluates to false and the control comes to line #7 and the to line #2. In the second case, the condition becomes satisfied and the control executes the line # blocks from 4 to 6. After that it reaches to line #2 and the program continues in this manner

CONTINUE-WHEN statement

Syntax

Continue-When(Condition)

Once the condition in the When clause is evaluated and if found true, the current iteration of the loop completes and control passes to the next iteration.

Let us see into action

SQL> BEGIN
  2     FOR i IN 1 .. 10 LOOP	
  3        CONTINUE WHEN MOD(i,2) = 0;        
  4       DBMS_OUTPUT.PUT_LINE('Numbers := ' || TO_CHAR(i));
  5     END LOOP;
  6  END;
  7  /
Numbers := 1
Numbers := 3
Numbers := 5
Numbers := 7
Numbers := 9
PL/SQL procedure successfully completed.

We can figure out that the even numbers trigger the control to the beginning of the loop.

The CONTINUE-WHEN statement can also be used with LOOP LABELS as shown under

SQL> BEGIN
  2     <<outer_loop>>
  3     FOR i IN 1 .. 10 LOOP
  4        CONTINUE outer_loop WHEN MOD(i,2) = 0;
  5        DBMS_OUTPUT.PUT_LINE('Numbers := ' || TO_CHAR(i));
  6     END LOOP;
  7  END;
  8  /
Numbers := 1
Numbers := 3
Numbers := 5
Numbers := 7
Numbers := 9
PL/SQL procedure successfully completed.

We have the Continue statement in Sql Server too about which u can read from

  1. SQL SERVER – Simple Example of WHILE Loop with BREAK and CONTINUE
  2. SQL SERVER – Simple Example of WHILE Loop With CONTINUE and BREAK Keywords

Hope this was useful.Thanks for reading

Tags: BRH, #SQLServer, SQL Server, PL/SQL,


Niladri Biswas
7 · 21% · 6710
1
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"Day 63: PL/SQL - 11 (CONTINUE and CONTINUE-WHEN statement in Oracle 11g's Pl/SQL)" rated 5 out of 5 by 1 readers
Day 63: PL/SQL - 11 (CONTINUE and CONTINUE-WHEN statement in Oracle 11g's Pl/SQL) , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]