Question: create or replace procedure firstthree (my_seqid in varchar2) as cursor c1 is select sname, grade from student s join taken t on s.sid=t.sid where seqid=my_seqid

create or replace procedure firstthree (my_seqid in varchar2) as

cursor c1 is

select sname, grade from student s join taken t on s.sid=t.sid

where seqid=my_seqid

order by grade desc;

-- my_sname varchar2(40);

my_sname student.sname%TYPE;

-- my_grade number(2,1);

my_grade taken.grade%TYPE;

begin

/* clear the my_tmp table */

delete from my_tmp;

commit;

open c1;

for i in 1..3 loop

fetch c1 into my_sname, my_grade;

exit when c1%notfound; /* in case the number requested */

/* is more than the total */

/* number of enrolled students */

/* display the result */

dbms_output.put_line('name: ' || my_sname || ' ' || 'grade: ' || my_grade);

/* put into temporary table */

insert into my_tmp values(my_sname, my_grade);

commit;

end loop;

close c1;

end;

/

create or replace procedure firstthree (my_seqid in varchar2) as

cursor c1 is

select sname, grade from student s join taken t on s.sid=t.sid

where seqid=my_seqid

order by grade desc;

-- my_sname varchar2(40);

my_sname student.sname%TYPE;

-- my_grade number(2,1);

my_grade taken.grade%TYPE;

begin

/* clear the my_tmp table */

delete from my_tmp;

commit;

open c1;

for i in 1..3 loop

fetch c1 into my_sname, my_grade;

exit when c1%notfound; /* in case the number requested */

/* is more than the total */

/* number of enrolled students */

/* display the result */

dbms_output.put_line('name: ' || my_sname || ' ' || 'grade: ' || my_grade);

/* put into temporary table */

insert into my_tmp values(my_sname, my_grade);

commit;

end loop;

close c1;

end;

/

Modify the stored procedure and the above PHP code to output (echo) the average of the top three grades in the Web page. You need to modify the header of procedure firstThree() to

create or replace procedure firstThree(my_seqid in varchar2, my_average out number)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!