For-loop -iterative control, PL-SQL Programming

Assignment Help:

FOR-LOOP

While the number of iterations through a WHILE loop is unknown till the loop completes, then the number of iterations through a FOR loop is known before the loop is entered. The FOR loops iterate over a particular range of integers. The range is the part of an iteration scheme that is enclosed by the keywords FOR and LOOPS. A double dot (..) serve as the range operator. The syntax is as shown below:

FOR counter IN [REVERSE] lower_bound..higher_bound LOOP
sequence_of_statements
END LOOP;


The range is computed when the FOR loop is first entered and is never re-evaluated.



As the next illustration shows, the series of statements is executed once for each integer in the range. After each of the iteration, the loop counter is incremented.

FOR i IN 1..3 LOOP -- assign the values 1,2,3 to i
sequence_of_statements -- executes three times
END LOOP;


The following illustration shows that if the lower bound equals the higher bound, the series of the statements is executed once:

FOR i IN 3..3 LOOP -- assign the value 3 to i
sequence_of_statements -- executes one time
END LOOP;


Related Discussions:- For-loop -iterative control

Predefined exceptions, Predefined Exceptions The internal exception is ...

Predefined Exceptions The internal exception is raised implicitly whenever your PL/SQL program exceeds a system-dependent limit or violates an Oracle rule. Each & every Oracle

Processing transactions, Processing Transactions This part describes ho...

Processing Transactions This part describes how to do the transaction processing. You learn the fundamental techniques that safeguard the consistency of your database, involvin

Keyword and parameter description - delete statement, Keyword and Parameter...

Keyword and Parameter Description: table_reference: This specifies a table or view that should be accessible when you execute the DELETE statement, and for that you must

Name resolution - pl/sql, Name Resolution   During the compilation, th...

Name Resolution   During the compilation, the PL/SQL compiler relates identifiers like the name of a variable with an address or memory location, actual value, or datatype. Th

Functions in pl/sql, Functions   The function is a subprogram that cal...

Functions   The function is a subprogram that calculates a value. The Functions and procedures are structured similar, except that the functions have a RETURN clause. You can

Overriding default locking, Overriding Default Locking By default, the...

Overriding Default Locking By default, the Oracle locks the data structures for you automatically. Though, you can request exact data locks on rows or tables when it is to you

Exit statement - syntax, EXIT Statement   You can use the EXIT stateme...

EXIT Statement   You can use the EXIT statement to exit a loop. The EXIT statement has 2 forms: the conditional EXIT WHEN and the unconditional EXIT. With the either form, you

Cosmozoic theory - origin of life, COSMOZOI C THEORY - Richter (1865...

COSMOZOI C THEORY - Richter (1865) proposed the cosmozoic theory that says that life came by spores (cosmozoa) or other particles from other planets on the earth.

Declaring a cursor, Declaring a Cursor The Forward references are not ...

Declaring a Cursor The Forward references are not allowed in the PL/SQL. Therefore, you must declare a cursor before referencing it in other statements. Whenever you declare a

Effects of null for union - sql, Effects of NULL for union - SQL The ...

Effects of NULL for union - SQL The treatment of NULL in invocations of EXCEPT is as for UNION. This is different from its treatment in those of NOT IN and quantified compari

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd