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

Package dbms output in pl/sql, DBMS_OUTPUT: The Package DBMS_OUTPUT en...

DBMS_OUTPUT: The Package DBMS_OUTPUT enables you to display output from the PL/SQL subprograms and blocks, that makes it easier to test and debug them. The procedure put_ line

Use the pls_integer datatype - performance of application, Use the PLS_INTE...

Use the PLS_INTEGER Datatype When you require to declare an integer variable, use the datatype PLS_INTEGER that is the most efficient numeric type. That is as the PLS_INTEGER

Exception handling, Exception handling In the PL/SQL, a warning or erro...

Exception handling In the PL/SQL, a warning or error condition is known as an exception. The Exceptions can be internally defined (by the run-time system) or user defined. The

Using lock table, Using LOCK TABLE You use the LOCK TABLE statement to...

Using LOCK TABLE You use the LOCK TABLE statement to lock the whole database tables in the specified lock mode so that you can share or deny the access to them. For illustrati

I need sql data base, I need SQL Data Base Project Description: Netwo...

I need SQL Data Base Project Description: Network SQL database and SQL Setup two 4 workstation Skills required are Data Entry, MySQL, SQL

Procedural constraint enforcement (triggers) , Procedural Constraint Enforc...

Procedural Constraint Enforcement (Triggers) SQL has an alternative method of addressing database integrity, involving event-driven procedural code. The special procedures th

Procedures in pl/sql, Procedures   The procedure is a subprogram which...

Procedures   The procedure is a subprogram which performs a specific action. You write procedures using the syntax as shown below: PROCEDURE name [(parameter[, parameter, .

Cursor variables, What Are Cursor Variables  ? The Cursor variables ar...

What Are Cursor Variables  ? The Cursor variables are like C or Pascal pointers that hold the memory location (address) of some item rather of the item itself. Therefore, decl

Example of shorthand for a row constraint - sql, Example of Shorthand for a...

Example of Shorthand for a row constraint Example: Shorthand for a row constraint ALTER TABLE EXAM_MARK ADD CONSTRAINT Mark_in_range CHECK (Mark BETWEEN 0 AND 100);

Recursion, Recursion The Recursion is a powerful method for simplify th...

Recursion The Recursion is a powerful method for simplify the design of the algorithms. Principally, the recursion means the self-reference. In the recursive mathematical serie

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