MySQL Forums :: Stored Procedures :: Student_id and MAX score in one OUT parameter


Advanced Search

Re: Student_id and MAX score in one OUT parameter
Posted by: Peter Brawley ()
Date: May 13, 2016 07:55AM

The requirement you describe is unclear. To return a student_id and her max score requires just one student_id, no need for "start" and "end" student_ids. There's no need for her name either, or for Group By aggregation. Or for delimiter directives since the job can be done in one logical line ...

drop procedure if exists max_score;
create procedure max_score( in pid int, out rc varchar(128) )
set rc = concat( "student ", pid, " highest score is ", (select max(score) from score where student_id=pid) );
set @rc='';
call max_score(1,@rc );
select @rc;

Options: ReplyQuote


Subject Views Written By Posted
Student_id and MAX score in one OUT parameter 2215 B Aneja 05/10/2016 08:56PM
Re: Student_id and MAX score in one OUT parameter 359 Peter Brawley 05/10/2016 09:59PM
Re: Student_id and MAX score in one OUT parameter 872 B Aneja 05/10/2016 11:38PM
Re: Student_id and MAX score in one OUT parameter 354 Peter Brawley 05/13/2016 07:55AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.