CS405 Short Notes by Muhammad Ayaz
- Type
- Quiz
- Course
- CS405 Database Programming using Oracle 11g
- Size
- PDF 1 MB
- Updated
- 23 Oct 2026
You get 3 free files a day on the website. Add the Chrome extensionSign in with the extension for 30 a day.
Preview text
Text from pages 1, 3, 4 of 18. Download the file for all 18 pages.
The simple loop is different from other loops available in other programming languages; simple loop consists of a structure to repeat statements Without exit condition considers to be an infinite loop. Required to exit the loop DECLARE rep number(10):=0; BEGIN LOOP if rep >=5 then dbms_output.put_line (' Value of Rep: ' || rep); EXIT; END IF; rep:=rep+1; END LOOP; END;
While Loop
First check the condition and then other loop we be executed
DECLARE
A DO-While loop is a statement that executes a statement at least once and then repeatedly executes the block, or not, depending on a given condition at the end of the block. We not write the Do keyword in this just we write the loop like simple Loop Not required to exit the will automatically end the loop if the condition is false
Implementing Do While Loop
DECLARE
current_val number (10):=0;
BEGIN
LOOP
dbms_output.put_line (' Value of count is : ' || current_val);
current_val:=current_val+1;
exit when current_val> 10 ;
END LOOP;
END;
Numeric FOR Loop
A FOR LOOP is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times. It’s called Numeric because it requires an integer as its terminating point.
Starting limit to upper limit
Not jump in the value in the for loop
If the first value of the for loop is less then the upper value the control move to the for loop body
DECLARE
i NUMBER:= 100;
BEGIN
FOR i IN 1..10 LOOP
dbms_output.put_line ( ' Value of I : ' ||i);
i:=i+1; --Error
END LOOP;
end;
FOR Loop with Reverse Option
By default, iteration proceeds from the initial value to the final value, generally upward from the lower bound to the higher bound. You can reverse this order by using the REVERSE keyword. DECLARE
loop_start Integer: = 1;
BEGIN
FOR i IN REVERSE loop_start..5
LOOP
DBMS_OUTPUT.PUT_LINE (' Loop counter is ' || i);
END LOOP;
Related CS405 files
All CS405 files →Get more out of VUBuddy, for free
- Unlimited downloads
- The explanation behind every MCQ answer
- Study offline on slow data
- 30 downloads a day instead of 3
- Sign in and buy Pro Semester here
One Pro Semester membership works in both the extension and the app.