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, 2589🔥, 0💬
Popular Posts:
What Are Out-of-Range Errors with DATETIME values in SQL Server Transact-SQL? When you enter DATETIM...
How To View Data Files in the Current Database in Oracle? If you want to get a list of all tablespac...
How to convert a JSON (JavaScript Object Notation) quoted string into a regular character string usi...
How to download and install Microsoft .NET Framework Version 2.0 in SQL Server? .NET Framework Versi...
How To Get Help Information from the Server in MySQL? While you are at the "mysql>" prompt, y...