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, 3170🔥, 0💬
Popular Posts:
Where to find answers to frequently asked questions in general areas of Microsoft SQL Server Transac...
Where to find reference information and tutorials on MySQL database functions? I want to know how to...
Where to find answers to frequently asked questions on Downloading and Installing SQL Server 2005 Ex...
Where to find answers to frequently asked questions on Transaction Management: Commit or Rollback in...
What are single-byte character string data types supported in SQL Server Transact-SQL? Single-byte c...