Question
Notice: be sure to execute the following command before you start working on the following questions. set serveroutput on; 1. Re-do the question 4 of
Notice: be sure to execute the following command before you start working on the following
questions.
set serveroutput on;
1. Re-do the question 4 of the PL/SQL Assignement 1 by using loop control.
Hint: consider using VARRAY. For example
DECLARE
type gradeCount is varray(5) of integer;
gdcnt gradeCount;
type grade is varray(5) of char(1);
gd grade;
BEGIN
gdcnt := gradeCount(0,0,0,0,0);
gd := grade(A, B, C, D, F);
END;
2. Type the following anonymous block and execute it.
DECLARE
sm binary_integer :=0;
i binary_integer :=0;
BEGIN
loop
i := i + 1;
if i > 10 then
exit;
end if;
sm := sm + i;
end loop;
dbms_output.put_line('sum= ' || sm || '.');
END;
3. Revise the above program by using for loop and while loop respectively, and
execute them. The revised program should have the same result as the above program.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started