Collections:
Use "FOR" Loop Statements in Oracle
How To Use "FOR" Loop Statements in Oracle?
✍: FYIcenter.com
If you have a block of codes to be executed repeatedly over a range of values, you can use the "FOR ... LOOP" statement. Here is a sample script on FOR statements:
DECLARE
total NUMBER := 0;
BEGIN
FOR i IN 1..10 LOOP
total := total + i;
END LOOP;
DBMS_OUTPUT.PUT_LINE('Total: ' || TO_CHAR(total));
END;
Note that temporary variable "i" used in the FOR loop needs no declaration. This script should print this:
Total: 55
⇒ What Is NULL in PL/SQL in Oracle
⇐ Use "WHILE" Loop Statements in Oracle
2018-07-13, 2617🔥, 0💬
Popular Posts:
Is PL/SQL Language Case Sensitive in Oracle? PL/SQL language is not case sensitive: Reserved words a...
How To Divide Query Output into Multiple Groups with the GROUP BY Clause in SQL Server? Sometimes, y...
How To Start MySQL Server in MySQL? If you want to start the MySQL server, you can run the "mysqld" ...
How To Get the Definition of a View Out of the SQL Server in SQL Server? If you want get the definit...
How To Get the Definition of a View Out of the SQL Server in SQL Server? If you want get the definit...