Collections:
Use "WHILE" Loop Statements in Oracle
How To Use "WHILE" Loop Statements in Oracle?
✍: FYIcenter.com
If you have a block of codes to be executed repeatedly based a condition, you can use the "WHILE ... LOOP" statement. Here is a sample script on WHILE statements:
DECLARE
total NUMBER;
BEGIN
total := 0;
WHILE total < 10 LOOP
total := total+1;
END LOOP;
DBMS_OUTPUT.PUT_LINE('Total counts: ' || TO_CHAR(total));
END;
This script should print this:
Total counts: 10
⇒ Use "FOR" Loop Statements in Oracle
⇐ Use "IF" Statements with Multiple Conditions in Oracle
2018-07-13, 2716🔥, 0💬
Popular Posts:
How to format a number of bytes in a human-readable unit using the FORMAT_BYTES() function? FORMAT_B...
How To Divide Query Output into Multiple Groups with the GROUP BY Clause in SQL Server? Sometimes, y...
How To Break Query Output into Pages in MySQL? If you have a query that returns hundreds of rows, an...
How To Get Help Information from the Server in MySQL? While you are at the "mysql>" prompt, y...
How To Locate and Take Substrings with CHARINDEX() and SUBSTRING() Functions in SQL Server Transact-...