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, 1552🔥, 0💬
Popular Posts:
How To Connect the Oracle Server as SYSDBA in Oracle? This is Step 4. The best way to connect to the...
How To Replace Given Values with NULL using NULLIF() in SQL Server Transact-SQL? Sometime you want t...
How To Start Instance with a Minimal Initialization Parameter File in Oracle? The sample initializat...
How to set the current database in SQL Server? Once you are connected to the SQL Server, you should ...
Where to find MySQL database server tutorials? Here is a collection of tutorials, tips and FAQs for ...