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, 2922🔥, 0💬
Popular Posts:
How To Convert Characters to Numbers in Oracle? You can convert characters to numbers by using the T...
How To List All Login Names on the Server in SQL Server? If you want to see a list of all login name...
How To Convert Numeric Expression Data Types using the CAST() Function in SQL Server Transact-SQL? I...
What Are the Basic Features of a Trigger in SQL Server? Since a SQL Server trigger is a really an ev...
How To Connect ASP Pages to Oracle Servers in Oracle? If you are running Windows IIS Web server and ...