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, 2301🔥, 0💬
Popular Posts:
How To Use DATEADD() Function in SQL Server Transact-SQL? DATEADD() is a very useful function for ma...
How To Count Rows with the COUNT(*) Function in SQL Server? If you want to count the number of rows,...
What Is a Parameter File in Oracle? A parameter file is a file that contains a list of initializatio...
Can You Drop an Index Associated with a Unique or Primary Key Constraint in Oracle? You can not dele...
How To Create a Table Index in Oracle? If you have a table with a lots of rows, and you know that on...